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

Detect if user moved map or if it happened programatically iOS Mapkit

Ok so I have a map loaded with pins from a remote JSON feed which is loaded into the app. This all works fine. Now from initial experimenting regionDidChangeAnimated gets called multiple times and so I moved my post request to a method that uses a…
Alex McPherson
  • 3,185
  • 3
  • 30
  • 41
4
votes
1 answer

Turning user location annotation with heading

I'm trying to change the User Annotation in my app so that it shows the usual blue dot, but with a triangle coming off of it to show which direction the user is facing (I'd rather rotate the user annotation than the entire map, which is what…
RL2000
  • 913
  • 10
  • 20
4
votes
1 answer

PopOver For Annotation View

Well i have a question? Im Confuse! I have a mapview where the annotations are layed out.Now i want a popover for annotations. how Should i do it 1.Create a popover controller in storyboard and push it from delgate method. 2.Create a programmatic…
Dheeraj Kaveti
  • 309
  • 1
  • 2
  • 9
4
votes
3 answers

MKAnnotationView custom image is not shown

I am trying to add a custom image instead of the regular pin on the map. But it remains a red pin... What am I missing? - (MKAnnotationView *) mapView:(MKMapView *)mapView viewForAnnotation:(id ) annotation{ static NSString*…
Luda
  • 7,282
  • 12
  • 79
  • 139
4
votes
1 answer

MKAnnotationView - Callout title or description with multiple lines?

Is it possible to display several lines in title or description/subtitle without writing your own custom annotation view, using i.e. MKPinAnnotationView?
Stianhn
  • 275
  • 2
  • 14
4
votes
0 answers

Is there a way to set a MKMapView map to an alpha lower to 1 and its markers to 1?

I'd like to have a map that is faded, but with full-opacity markers. Is this possible? I've set the map to 0.5 opacity in my XIB, but don't see a way to change the alpha programmatically (to the marker being added or the viewForAnnotation method).
annie
  • 1,347
  • 1
  • 13
  • 25
3
votes
2 answers

add mkannotation on touch map

I want to add a mkannotation to my mkmapview when an user taps over the map so they can choose a location. I've read about the drag&drop but that's a bit annoying if you want to move to the other corner of the city because you have to move step by…
Ibai
  • 568
  • 1
  • 7
  • 21
3
votes
1 answer

How can the MKUserLocation be programmatically selected?

Titles and subtitles can be added to the user location that iOS shows using MKUserLocation. When the user taps on the location, these will show in a bubble above the location. The thought bubbles for other annotations can be shown by selecting the…
Mike
  • 3,084
  • 1
  • 25
  • 44
3
votes
1 answer

Using UILongPressGestureRecognizer together with draggable MKPinAnnotationView in MKMapView

I have having problems using a UILongPressGestureRecognizer together a draggable MKPinAnnotationView. The behaviour I am trying to produce is similar to the Maps App. The pin can be dragged. When there is a long press/ tap, a pin is…
maskie
  • 447
  • 4
  • 8
3
votes
2 answers

How to create a callout bubble MKAnnotationView that respond to touches

I'm trying to make a custom annotation view able to respond to touches without success. Thanks to this question I was able to made an annotation view close to what I want customize callout bubble for annotationview? also seen this How to capture…
Andrea
  • 26,120
  • 10
  • 85
  • 131
3
votes
3 answers

Is there a way to subclass the MKAnnotationView used for the MKUserLocation blue dot?

I've created a custom annotation view by subclassing MKAnnotationView. This class also creates a custom callout (info pop-up 'bubble') view which is skinned to match my app. I also want to be able to reskin the callout bubble for the user location…
jowie
  • 8,028
  • 8
  • 55
  • 94
3
votes
1 answer

User interaction blocking new annotations views

I developed a small application using MKMapView where MKAnnotations are added continuously on the map. It works well as long as the user does not touch the map view. If the user tries to interact with the map, I noticed that no new MKAnnotationViews…
user452037
3
votes
3 answers

Change Pin Color when user tapped

I would change the color from red to green of an annotation when the user pin tapped addition to changing its title and subtitle. I am truly lost. I searched how to make a custom annotation pin, ok. I found the implementation of the method when the…
Antonio
  • 33
  • 1
  • 4
3
votes
0 answers

MapKit: How to transform a location indicator image to the correct bearing when the map pitch != 0

I have an MKMap view with a custom image (as an MKAnnotationView) that shows the current course bearing direction as shown below (The image is the blue circle with the directional arrow and extending dotted blue line): MapKit provides the current…
3
votes
5 answers

mapView:didDeselectAnnotationView: delegate method getting called before the annotation view is actually deselected

I am working with a map view populated with custom pins. When the user taps somewhere on the map to deselect a pin, I want to implement the map such that the pin does not become deselected (i.e. users are not able to deselect pins without selecting…