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
89
votes
9 answers

How to customize the callout bubble for MKAnnotationView?

I'm currently working with the mapkit and am stuck. I have a custom annotation view I am using, and I want to use the image property to display the point on the map with my own icon. I have this working fine. But what I would also like to do is to…
Zach
  • 1,194
  • 2
  • 11
  • 14
64
votes
8 answers

Draw a circle of 1000m radius around users location in MKMapView

(Using iOS 5 and Xcode 4.2) I have an MKMapView and want to draw a circle of 1000m radius around the user location. On the surface it would seem that implementing the mapView:viewForAnnotation: map view delegate method, and adding a custom…
Jon Cox
  • 10,622
  • 22
  • 78
  • 123
55
votes
4 answers

MKAnnotation image offset with custom pin image

I have a MKAnnotation with an custom pin image. However the pin(MKAnnotationView) centers the image in relation to the specified coordinate. I want to set the point of the coordinate at the bottom center of the image, not center. I've tried using…
fredrik
  • 17,537
  • 9
  • 51
  • 71
43
votes
3 answers

Customize the MKAnnotationView callout

I want to create a custom MKAnnotationView callout as shown in this image. I have tested several solutions but they only allow customization of the left/right images and title/subtitle. Can anybody please give me some source code or tutorial link…
Janak Nirmal
  • 22,706
  • 18
  • 63
  • 99
38
votes
7 answers

iOS 8 MKAnnotationView rightCalloutAccessoryView misaligned

I'm still pretty new to the iOS stuff in general and found a problem while testing our App for iOS 8 compatibility. In iOS 7 everything worked fine but on iOS 8 the rightCalloutAccessoryView is misaligned under certain circumstances. First…
byemute
  • 643
  • 7
  • 15
35
votes
3 answers

MapKit not showing custom Annotation pin image on iOS9

My code worked fine from iOS 7 to 8. With the update yesterday the custom images on my pins were replaced by the standard pin image. Any suggestions? My code: extension ViewController: MKMapViewDelegate { func mapView(mapView: MKMapView,…
Felix Weber
  • 518
  • 1
  • 4
  • 8
30
votes
7 answers

How do I animate MKAnnotationView drop?

I have a custom MKAnnotationView where I set my image myself in viewForAnnotation. How do I animate it's drop like I can with MKPinAnnotationView? My code is - (MKAnnotationView *)mapView:(MKMapView *)map viewForAnnotation:(id…
30
votes
3 answers

MKAnnotationView - Lock custom annotation view to pin on location updates

Update #5 I guess it's bounty time. 100+ views and no one's taken a stab, even with the code sample I've posted. How about some reputation points! Update #4This is a pretty complicated question, so I created a new tab based project which just…
djibouti33
  • 12,102
  • 9
  • 83
  • 116
30
votes
2 answers

Swift different images for Annotation

I managed to get a custom icon for a annotation pin in Swift, but now I am still stuck using 2 different images for different annotations. Right now a button adds a annotation to the map. There should be another button that also adds a annotation…
Fabian Boulegue
  • 6,476
  • 14
  • 47
  • 72
28
votes
7 answers

Detect Tap on CalloutBubble in MKAnnotationView

Im working with MKMapView and MKAnnotationView. I have an annotation in the map. When the users tap on it, the callOut Bubble is displayed. When the annotation is tapped again ( and the callOut Bubble is visible ) i need to change to another…
Alejandro González
  • 638
  • 1
  • 8
  • 17
25
votes
3 answers

Car (Annotation) animation (like uber app) not working

I made one demo project (from Moving-MKAnnotationView demo on github) for moving car on map following is its link https://github.com/pratikbhiyani/Moving-MKAnnotationView I edit my code on the basis of given answer by vinaut but still problem is…
Pratik B
  • 1,599
  • 1
  • 15
  • 32
24
votes
3 answers

Swift - Add MKAnnotationView To MKMapView

I'm trying to add MKAnnotationView to MKMapView but I can't do it… Can anyone help me? Here is my code: override func viewDidLoad() { super.viewDidLoad() locationManager.desiredAccuracy = kCLLocationAccuracyBest …
Bogdan Bogdanov
  • 882
  • 11
  • 36
  • 79
21
votes
4 answers

MapKit iOS 9 detailCalloutAccessoryView usage

After watching WWDC video 206 I assumed this would be a trivial task of adding the detail callout view to a mapView annotation view. So, I assume Im doing something wrong. With my pin view set up func mapView(mapView: MKMapView, viewForAnnotation…
DogCoffee
  • 19,820
  • 10
  • 87
  • 120
19
votes
3 answers

Custom pin image in annotationView in iOS

I'm trying to change from Swift 1.2 to Swift 2.0 and I'm at the end of the changes. Currently I'm making changes in the MapViewController, and there isn't any error or warning, but the custom image for my pin (annotationView) it's not assigned to…
Jordi Gámez
  • 3,400
  • 3
  • 22
  • 35
19
votes
1 answer

How to create Custom MKAnnotationView and custom annotation title and subtitle

I need to create above Annotation view on MKMapView. I am able to create the custom annotation view but on the tap of annotation the view need to be opened image with that big text, I am not able to create that one. Please provide me some links or…
Abhishek
  • 2,255
  • 1
  • 13
  • 21
1
2 3
65 66