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
-1
votes
1 answer

Pass data in swift from one class to another

I have an app where a user takes a photo and he creates the annotation on the map with this photo, the photo has to be transferred to ImageAnnotation class and than a pin must be created on the map import UIKit import MapKit import…
-1
votes
1 answer

How to use a custom XIB for MKAnnotationView?

I want to use a custom XIB to use instead of MKAnnotation View, but I can't find any sources online that can help me. To be clear, I don't want a callout, I don't want an image in place of the pin, I want to replace the pin completely with an…
Akshay
  • 167
  • 1
  • 11
-1
votes
1 answer

Size of custom MKPointAnnotation

I've a problem with the size of a custom MKAnnotationView. I set a custom image but when the zoom of the MKMapView change the size of the annotation don't. I lost the default behaviour of the annotation like disappear in term of the zoom, resizing…
-1
votes
1 answer

Deleting wrong displayed annotation when deleting selected MKAnnotation from map SWIFT 4.1

I have an userAlertAnnotationArray: [MKAnnotations] that gets entries from data retrieved from Firebase. The deleting part is working perfectly with posts in Firebase and entries in the array, but it fails when deleting the selected MKAnnotation…
Vincenzo
  • 5,304
  • 5
  • 38
  • 96
-1
votes
1 answer

How to use standard MKAnnotation Symbol with a custom made MKAnnotationView

I customized my callOutView, creating an own AnnotationView theGreatAnnotationView, but I want to keep the standard Annotation Pin on the map. In this code I use a custom annotation image view?.image = annotation.image but when is delete the line,…
TheRJI
  • 17
  • 2
-1
votes
1 answer

Map annotation index number keep changing

I wanted to get the map annotation index number when clicking on the map point, but I had one issue which is when I run the app for the first time and click on the point it show me index = 5. But when I re-run the app and click on the same point…
Nur II
  • 173
  • 1
  • 2
  • 16
-1
votes
1 answer

How to have a MKPinAnnotationView open when pin is dropped

I currently am dropping a reusable pin using this function: func mapView(_ mapView: MKMapView, viewFor annotation: MKAnnotation) -> MKAnnotationView?{ guard !(annotation is MKUserLocation) else { return nil } let reuseId = "pin" var…
Zog
  • 1,094
  • 2
  • 11
  • 24
-1
votes
2 answers

how to get permission for map and zoom to user location?

I tired to get indexpath of my custom annotation , I use this code for get my indexpath NSUInteger index =[mapView.annotations indexOfObject:view.annotation]; its not really working because in my map, i got right lat and lang but not get the true…
-1
votes
1 answer

Swift - Converting NSMutableArray to array of MKAnotationViews

So essentialy this is what I have current. An array of var bars = [BarAnnotation(latitude: 42.022352, longitude: -93.650413, name: "Micky's Irish Pub", deal: "$2 Drinks 9PM-1AM"), BarAnnotation(latitude: 42.021948, longitude: -93.650348, name:…
leerob
  • 2,876
  • 1
  • 18
  • 38
-1
votes
1 answer

Callout I click on Map and appears ViewController2

I cannot see the second entry in the Map and take me to DetailViewController2. Is there any way to fix this? #import "MapViewController.h" #import "DetailViewController.h" #import "DetailViewController2.h" #import "SFAnnotation.h" //…
-1
votes
1 answer

Issue when trying to initialise an annotationView

I want to convert a custom MKAnnotationView written in Obj-C to Swift and I am having an error when I want to initWithAnnotation. Below I will provide both the ObjC and The Swift code: class JPThumbnailAnnotationView:…
tudoricc
  • 709
  • 1
  • 12
  • 31
-1
votes
2 answers

Clustering annotations won't work

Today i started to use ADClusterMapView ( https://github.com/applidium/ADClusterMapView ) and studied the example project... so i decided to add the content to my project... every thing was OK no red errors... the simulator turned on and posted a…
ABundzs
  • 13
  • 1
  • 5
-1
votes
1 answer

Can I get a gif out of a custom MKAnnotationView?

I need to get gifs with different colors from this library: https://github.com/samvermette/SVPulsingAnnotationView In the library I have access to the layer of the MKAnnotationView. But I need an animated gif of the generated annotation to use in a…
Aboelseoud
  • 556
  • 1
  • 7
  • 22
-1
votes
2 answers

Show User's current location on map

I am trying to display user's current location on the map but for some reason, does not takes my default coordinates. I have a MKMapView class that called inside a UIViewController. MapView.h #import #import #import…
OutOfBoundsException
  • 756
  • 1
  • 11
  • 26
-1
votes
1 answer

MKPinAnnotationView not moving while change location

I am working on location based application in which i need to move MKAnnotation Pin as per the change location. It means as user change location from once place to other the Annotation should be moved. This is my code of…
Mayur Prajapati
  • 5,454
  • 7
  • 41
  • 70
1 2 3
65
66