Questions tagged [mapkitannotation]

MKAnnotation is the protocol that annotation objects must implement in order to be rendered on apple maps. The only absolute requirement is to provide a coordinate attribute. This is a CLLocationCoordinate2D object containing the latitude and longitude of your annotation.

The application obtains the data from a resource. This could be Core Data, a ReST call or any other suitable source. It is recommended that this be done on a background thread to not impact UI performance.

This data is then used to instantiate MKAnnotation objects. In addition to the required CLLocationCoordinate2D attribute a title can be supplied to display underneath the map pin. A subtitle will be displayed when the user selects the pin.

Annotations can be added individually or as an array to a MKMapView. The map will call its viewFor delegate when it is time to render the annotation. The application should attempt to dequeue an annotation view and if one is not available it should create a new one. This is the same paradigm used for table rows.

Finally assign the annotation to the AnnotationView. Additional options exist in MKMarkerAnnotationView to further customize e.g. changing the color of the marker pin.

Related tags:

References:

MKAnnotation

236 questions
3
votes
2 answers

Use MKAnnotation to move on the next View Controller

i'm new in swift programming. I want when user tap a MKAnnotationPoint to move on the next view controller. The way i do it now is by pressing the Button "Button" as you see at the top of image1. My code: mapViewController.swift import UIKit import…
Roula Chiouma
  • 141
  • 10
3
votes
0 answers

ColorPointAnnotation for map kit in swift 3 not working

This is what i have now still not working. Notice the comment lines for color. I am trying to make make the Olso pin the standard red. But I would like to change the color of the london pin so its not red. So 2 different pins would have different…
user7459574
3
votes
1 answer

Map Clustering with Swift 2

I am looking for clustering markers in MapKit, so I found this library: FBAnnotationClusteringSwift that answers my needs. But it is for swift 3. Can anyone find the same library for swift 2. Thanks.
Niib Fouda
  • 1,242
  • 13
  • 19
3
votes
2 answers

Custom Map Annotation is blurry

Hi I have created a custom annotation in Sketch 3 and when I scale it down to fit into the map view it becomes blurry. How do I fix this?
Trip Phillips
  • 420
  • 5
  • 17
3
votes
1 answer

iOS Custom Annotation: A view below the annotation pin

I need to replace the default annotation view with my custom annotation view. I need the do following things: Custom Annotation view with an image view embedded in it. A view below it which contains a label in it. For more clarification see the…
iYoung
  • 3,413
  • 3
  • 29
  • 56
2
votes
1 answer

How to change displayPriority of MKUserLocation annotation in MapView?

I have a MapView displaying some annotations with displayPriority = .defaultHight to allow automatic clustering. The MapView also displays the current user location which has a default display priority of required. This causes my annotations to be…
funkenstrahlen
  • 2,712
  • 2
  • 23
  • 38
2
votes
0 answers

go to a SwiftUI view by tapping a pin annotation

I want to go to new SwiftUI View by tapping a pin annotation I have made a mapView and pin annotation on it I want to go to a SwiftUI view by Tapping on this pin how can I go to SwiftUi view in Uiviewrepresentable View this is my mapView func…
Alireza12t
  • 267
  • 2
  • 10
2
votes
1 answer

How to fix custom Point Annotations from disappearing from overlap?

Attempting to show custom point annotations from MapKits local search. When the annotations first load on the map all of them show, but then the overlapping ones disappear. And they only reappear when you zoom in on the area. Many stack solutions…
JayPhipps
  • 23
  • 3
2
votes
1 answer

swift 4 Annotation from json not visible until user drags on map

I am having problems showing the annotations on the map. They only show when I move or drag the map. I tried to follow tutorial on youtube and also one of the questions which is c sharp Please can sone one help .. here is the code Here I created a…
hesh
  • 65
  • 3
  • 12
2
votes
1 answer

Swift Mapview Custom Call Out View with default map view pins

I believe this is going to be a really easy answer but I've been trying to figure out how I add a custom callout view with map views default pins. With my current code it seems I can only add an image as the MKPointAnnotation instead of the default…
Lukas Bimba
  • 654
  • 10
  • 31
2
votes
3 answers

How to remove map Places and annotations from MKMapKit in Objective c

Hi i have an MapView in My Project i need to remove all the labels Annotations, places from MapView. Looks like Plain mapView i tried the Following Code its working fine but still i getting some building details, Street names and all i want that…
batMan007
  • 413
  • 1
  • 5
  • 22
2
votes
1 answer

MapKit custom image for multiple annotations

I have news objects and I want to customize the news annotation according to the news category. Without the switch statement, if I just write annotationView?.image = UIImage(named: "ic_sports"), all annotations; images shows the sport image. How can…
Jumana Alhaddad
  • 255
  • 2
  • 6
  • 14
2
votes
0 answers

Disabling MKMapView clustering annotations automatically

I have an MKMapView in my App and I've added couple of annotations to it. the problem I am facing is that whenever the map is zoomed out the annotations are clustered automatically. How do I disable this automatic clustering? I am adding couple of…
Rezwan
  • 367
  • 4
  • 18
2
votes
1 answer

How programmatically select a specific annotation in Mapkit - Swift

I'm developing a map in MapKit/Swift 4 where i have a lot of annotations. User could select with a Picker View what annotation (just 1) he wants, and the annotation will be called (as if he had pushed on it). If it's easier, we could consider to…
Hugo75
  • 239
  • 2
  • 14
2
votes
1 answer

Trouble creating custom MKAnnotationView

I'm having a hard time displaying a custom annotation view. Specifically, I'm trying to set an image named "pin" to be the new map pin. The default pin always shows. I've been making small changes for a few hours to no avail, such as changing "pin"…
Cody Potter
  • 115
  • 10
1
2
3
15 16