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

256 questions
3
votes
2 answers

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
  • 3,032
  • 2
  • 28
  • 40
3
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
  • 817
  • 14
  • 35
3
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
  • 477
  • 5
  • 19
3
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
  • 249
  • 3
  • 15
3
votes
1 answer

Loading map pins from firebase onto mapkit in swift for all users to be able to see

Im creating a tagging app, where a user can tag street art to a map, this information is then available for all users to see. I can upload my data to Firebase however Im struggling being able to pull this data back down to appear on the map as an…
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
  • 151
  • 1
  • 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

MKMapView does call didSelect callback only once

I'm using a custom annotation in my mapkit project (in swift 3) to show multiple annotations on the map. It's showing and I can click on annotationn but only the first time. For openning the annotation again I need to click everywhere on the map and…
Almeida
  • 1,254
  • 12
  • 26
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,383
  • 1
  • 16
  • 21
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
  • 430
  • 1
  • 5
  • 18
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,596
  • 3
  • 32
  • 59
2
votes
1 answer

How do you properly display custom pins in SwiftUI / Mapkit?

I am in the process of building a SwiftUI app that relies on MapKit. But I am encountering an issue with the rendering of the custom pin marker. Whenever I add the pin, this is rendered from the center of the image so it does not properly align with…
Daniel DE
  • 85
  • 1
  • 8
2
votes
1 answer

Custom Annotations in SwiftUI (MKMapView)

I have implemented a MKMapView in SwiftUI and I am showing a list of annotations (stops) as well as the user's location. I wanted to add the tap functionality to the "stop pins" but I wasn't able to find anything helpful to achieve this. The problem…
arata
  • 859
  • 1
  • 8
  • 23
2
votes
1 answer

How to set a custom annotations for all points except for user location?

After the authorization checks, to obtain the user location, I am calling this CLLocation delegate function: func locationManager(_ manager: CLLocationManager, didUpdateLocations locations: [CLLocation]) { guard let latestLocation =…
BVB09
  • 805
  • 9
  • 19
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
  • 377
  • 1
  • 4
  • 14
1
2
3
17 18