Questions tagged [mkannotationview]

MKAnnotationView is part of Apple's Map Kit framework for developing iOS applications, an object that represents annotations visually in a map view.

Annotation views are loosely coupled to a corresponding annotation object, which is an object that corresponds to the MKAnnotation protocol. When an annotation’s coordinate point is in the visible region, asks its delegate to provide a corresponding annotation view. Alternatively (and simpler in many cases), you can simply register an particular annotation view with a particular identifier (notably the MKMapViewDefaultAnnotationViewReuseIdentifier and MKMapViewDefaultClusterAnnotationViewReuseIdentifier identifiers). Annotation views may be recycled later and put into a reuse queue that is maintained by the map view

Annotation views remain anchored to the map at the point specified by their associated annotation object. Although they scroll with the map contents, annotation views reside in a separate display layer and are not scaled when the size of the visible map region changes.

You can use the MKAnnotationView class as-is, use an existing subclass (such as MKMarkerAnnotationView), or subclass it yourself to provide custom behavior as needed. The image property of the class lets you set the appearance of the annotation view without subclassing directly.

See also

986 questions
4
votes
2 answers

MKAnnotationView image property

I have an MKAnnotationView (draggable property is set to YES) with a custom image, set via the image property. When the annotation is added to the map it has the custom image. But the image turns back to the default pin when the annotation is…
Ben Zwak
  • 225
  • 1
  • 3
  • 8
4
votes
2 answers

Displaying MKAnnotation callout automatically

Why doesn't this work? - (void)mapView:(MKMapView *)mapView didAddAnnotationViews:(NSArray *)views { if (TRACE_LOG) NSLog(@"%s", __FUNCTION__); [mapView selectAnnotation:[views lastObject] animated:YES]; return; } Thanks, Z@K!
Zak
  • 12,213
  • 21
  • 59
  • 105
4
votes
1 answer

How to change height of Annotation callout window Swift

How to change size of Annotation Callout Window on Map in Swift. I tried to make a bigger CGSize on each of the component of the right and left view but without any success Height of the view in the end is still the same. Here is my code: func…
Vuk Vasić
  • 1,398
  • 10
  • 27
4
votes
0 answers

MKAnnotation with custom bubleview in put button for ios?

I have create BubbleView in mapview. In bubble i have put the button but i have not click on button. How can i implement please help me. I have tried....... customCalloutView.h #import @interface customCalloutView :…
Rohit suvagiya
  • 1,005
  • 2
  • 12
  • 40
4
votes
1 answer

iphone annotations pins and buttons

Can anyone help me on how to use the - (void)mapView:(MKMapView *)mapView annotationView:(MKAnnotationView *)view calloutAccessoryControlTapped:(UIControl *)control { method. I am trying to tell the annotation pins on my project appart and I can't…
alecnash
  • 1,750
  • 1
  • 18
  • 42
4
votes
4 answers

How do I update an MKAnnotation location with new coordinates?

i'm having problems trying to update an annotation location with different coordinates. Is there any way I can change de location property without having to create another annotation? I've tried the code below with no luck. The annotation i'm trying…
user345711
  • 181
  • 2
  • 5
4
votes
1 answer

How do I change the image of an annotation for a coordinate?

I don't understand how to change the image of a mark point in Swift. I have tried a few variations of func mapView(mapView: MKMapView!, viewForAnnotation annotation: MKAnnotation!) -> MKAnnotationView! but it seems to never get called and I…
Scuttle
  • 165
  • 3
  • 11
4
votes
2 answers

Rotate annotation image on MKMapView

I am trying to rotate an image that is added to MKMapView as an annotation. This is the code: -(MKAnnotationView *)mapView:(MKMapView *)mapView viewForAnnotation: (id)annotation { if (! [annotation isKindOfClass:[IGAMapAnnotation…
Igor Tupitsyn
  • 1,193
  • 3
  • 18
  • 45
4
votes
3 answers

Custom Callout Bubble iOS

I am developing app with mapview functionality. I want to show custom pin image on mapview, click on that open custom callout bubble with image and title. With click on that callout bubble view I would like to do some functionality. How to achieve…
user2996143
  • 113
  • 1
  • 9
4
votes
1 answer

MKAnnotationView always shows infoButton instead of detailDisclosure btn

has somebody an idea why i can't force the mapView callout to use a detailDisclosureBtn instead of infoButton? - (MKAnnotationView *)mapView:(MKMapView *)mapView viewForAnnotation:(id )annotation { static NSString *identifier =…
user1788415
4
votes
5 answers

UIButtonTypeDetailDisclosure Color Change

I have changed the image of UIButtonTypeDetailDisclosure to the image below but the problem is that the image becomes in blue color. Where would be my issue? - (MKAnnotationView *)mapView:(MKMapView *)mV viewForAnnotation:(id…
Luai Kalkatawi
  • 1,492
  • 5
  • 25
  • 51
4
votes
2 answers

Prevent touch events on MKMapView being detected when a MKAnnotation is tapped

I have a UITapGestureRecognizer that will hide and show a toolbar over my MKMap when the user taps the Map - simple. However, when the user taps on an MKMapAnnotation, I do not want the map to respond to a tap in the normal way (above).…
totalcruise
  • 1,343
  • 2
  • 13
  • 25
4
votes
1 answer

Custom MKAnnotationView intermittently recognize touch

I have a custom MKAnnotationView that I am loading from an XIB. When I first load the mapview, I have several standard MKAnnotationView. When a user selects one, the custom MKAnnotationView is presented. I would like for the user to be able to tap…
rtvanals
  • 341
  • 1
  • 3
  • 7
4
votes
1 answer

Custom map callout view hides on tap

I've made custom map callouts. My callouts contains UIButtons and UITextView. When I tap UIButton, it presses nice. But when I tap UITextView it moves cursor to tap position and then deselects pin and disappears callout... I've implemented…
k06a
  • 17,755
  • 10
  • 70
  • 110
4
votes
3 answers

Check if an MKAnnotation is selected on a map?

I have a really simple question: how can I check if an MKAnnotation is selected on a map? I can't see a selected like (GET) property. I hope the solution would not be by triggering selected/deselected events and store its result in a property and…
Tom
  • 3,899
  • 22
  • 78
  • 137