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
7
votes
2 answers

MKUserLocation is selectable, falsely intercepting touches from custom MKAnnotationViews

I have a normal map in my iOS app where "Shows Users Location" is enabled - meaning I have my normal blue dot on the map, showing my position and accuracy info. The callout is disabled in code. But I also have custom MKAnnotationViews that are…
kbjeppesen
  • 335
  • 1
  • 3
  • 9
7
votes
5 answers

Check if mapView already contains an annotation

I have a method of adding secondary nearby annotations (ann2) when I tap on another annotation (ann1). But when I deselect and re-select the exact same annotation (ann1) the ann2 re-creates it self and is getting added again. Is there a way to check…
6
votes
1 answer

IOS: Adding image to custom MKAnnotationview

I want to add a custom image to my annotations in the map. And i have made the following custom MapAnnotationView: #import #import #import #import @class…
Roskvist
  • 1,030
  • 3
  • 14
  • 24
6
votes
1 answer

MKAnnotationView not showing up on the map

I am trying to annotate my map with MKPointAnnotation, like this: - (void)viewDidLoad { NSLog(@"RootViewController viewDidLoad"); [super viewDidLoad]; CLLocationCoordinate2D coord = …
user1044147
  • 108
  • 1
  • 6
6
votes
1 answer

Custom callout view for MKAnnotation?

The standard callout, a black bubble, is nice, but can this be customized? For instance I would like to make a white bubble version.
cannyboy
  • 24,180
  • 40
  • 146
  • 252
6
votes
1 answer

How to display multiple callouts from MKAnnotationView?

I like implement sth. like this. I have two annotations with callouts, but MKMapView allows only one to be selected at the same time. [mapView selectAnnotation:self.firstAnnotation animated:FALSE]; [mapView selectAnnotation:self.secondAnnotation…
6
votes
1 answer

Draw MKPointAnnotation with title in MKSnapshot image

I'm trying to draw an annotation exactly as in a 'live' MapView, but then in a MKSnapshot. Why an MKSnapshot > because I want to have non-interactive MapViews in a UITableView and using images is more efficient. I can get a pin to be drawn (though…
6
votes
2 answers

Subclasses of MKAnnotationView

I was wondering if anyone knows of any subclasses for the MKAnnotationView class. On apples documentation they say one example is the MKPinAnnotationView so I was wondering if there were other pre-created subclasses like the one used to track the…
bubster
  • 887
  • 1
  • 10
  • 17
6
votes
1 answer

MKMapView MKPointAnnotation tap event not called

I am using a MKMapView (delegate is set correctly) with a MKPointAnnotation. The annotations are generated in this method called on a background thread. func updateMapAnnotations() { for var i = 0; i < DataManager.getStationList().count; i++ { …
Tim
  • 284
  • 2
  • 10
6
votes
3 answers

mapView: didSelectAnnotationView: not functioning properly.

I'm building an IOS app that uses the built in map view. Im successfully placing custom annotations, etc. However, I'm having a problem with the delegate function that is called when an annotation is pressed (mapView:didSelectAnnotationView). The…
Nate
  • 510
  • 1
  • 4
  • 21
6
votes
3 answers

MKAnnotationView with custom view and image view

In my Map application, instead of showing a pin, I want to show a colored background circle with image in it. The color of the background (which is shade of green in below image) circle is dynamic. It will look as in below image: I created…
Satyam
  • 15,493
  • 31
  • 131
  • 244
6
votes
3 answers

MKMapView clustering if too many Map Pins nearby

I'm wondering if any of you knows a method (library, category, etc.) to cluster iOS MapAnnotations if there are many of them at the same location (e.g. 4 pieces in about 10m). It doesn't matter to zoom in because they are still overlapping. I've…
kimar
  • 191
  • 2
  • 8
6
votes
2 answers

Learn about the NSXMLParser in iOS

I learn about current NSXMLParser. I read many tutorials but none could tell me exactly how it works. there is a tutorial on StackOverflow? My problem is this KML read structur in my app and display with MKMapView My Parser class looks like: #import…
CTSchmidt
  • 1,155
  • 3
  • 17
  • 30
6
votes
1 answer

MKMapView Clicking on pins won't call didSelectAnnotationView

I am using a mapView and am trying to make a callout pop up when you click on a pin which is shown on the map. The pins manage to be placed in the proper locations so I think the annotations work but when I click on the pin it won't show a callout.…
6
votes
1 answer

MKMapKit regionDidChangeAnimated stops after tapping custom callout

I'm implementing a custom MKAnnotationView callout with the code explained here (Jacob's one), which actually places another Custom AnnotationView as the Annotation is selected: MKAnnotationView - Lock custom annotation view to pin on location…