iphone - Adding a clickable annotation to a UIMapView -
After
I want to add a comment to a MapView with the disclosure button and I can not understand it.
I have a placemark class that corresponds to the MKAnnotation protocol and can then create MapView and create a placemark to add:
// add annotation information location- Icon * placePlacemark = [[placemark alloc] initWithCoordinate: location]; PlacePlacemark.locationTitle = [Mixed Fareck: VENUE_NAME_KEY]; PlacePlacemark.locationSubtitle = @ "Touch to show in Google Maps"; // Create a secondary button on the placemark [venueMap addAnnotation: placePlacemark]; [CIRCLE SEATAGE: Area animated: TRUE]; [Sitemap Area: Fit Area:];
All this works and a pin is displayed when touched, the correct callout text is displayed. I do not understand how to add a disclosure button to call out is coming. Sorry if this is primary and any help would be appreciated.
Dave
After
Think I must have understood ... the following delegate method implemented (MKAnnotationView *) MapView: (MKMapView *) MapView viewForAnnotation: (ID of & lt; MKAnnotation & gt;) Annotation {MKPinAnnotationView * Droppin = [[MKPinAnnotationView alloc] initWithAnnotation: Annotation ReuseIdentifier: @ "places"]; UIButton * Disclosure Button = [System With UIButton Button: UIButtonTypeDetailDisclosure]; [DisclosureButton addTarget: Self-action: @selector (mapCallOutPressed :) forControlEvents: UIControlEventTouchUpInside]; DropPin.rightCalloutAccessoryView = Disclosure button; DropPin.animatesDrop = Yes; DropPin.canShowCallout = Yes; Return drop pin; }
Comments
Post a Comment