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
1
vote
2 answers

iOS MapKit - Is it possible to change a map pin based on map type?

I cannot find an exact question to this. I have some custom pins that look ok on a Standard map. I want to use other pins if the map changes to Satellite or Hybrid. Is this possible? I've tried this so far: annotationImageName =…
ICL1901
  • 7,632
  • 14
  • 90
  • 138
1
vote
0 answers

UIView as leftCalloutAccessoryView

I'm trying to add a UIView as the leftCalloutAccessoryView of a MapKitAnnotation but the textlabel I add to the UIView is not being shown and I don't understand why? let orderInfoView = UIView(frame: CGRectMake(0, 0, 100,…
user3054852
  • 179
  • 1
  • 11
1
vote
0 answers

How to get red color annotation for a particular coordinate

I want to denote all the user coordinate which are coming from query to Parse in green color but I want the one of the user (current) in red color. Below is what I have till now import UIKit import MapKit class MultipleAnnotationViewController:…
Unbreakable
  • 7,776
  • 24
  • 90
  • 171
1
vote
0 answers

Custom MapKit Annotation does not work

I am trying to create a custom Callout but for some reason the default point image does not change. I am fetching the data for the points using Parse. I have created a custom class (customAnnotationView) which inherits from MKAnnotationView and I…
nitse
  • 21
  • 7
1
vote
1 answer

How do I add the Info Button to a mapkit annotation in OSX (not ios) application

I'm trying to create a mapkit annotation for an OS X application and the default behaviour does not display the Info button. In an iOS app I would use the following: view.rightCalloutAccessoryView = UIButton.buttonWithType(.DetailDisclosure) as!…
DWoolly
  • 21
  • 5
1
vote
1 answer

mapkit select all annotations

I'm building an app using swift and MapKit. It has several custom point annotations. I would like to display the title above all annotations at any time, by default. Hence they would be all selected. Therefore I could get inspiration from this post…
Quentin Malgaud
  • 405
  • 6
  • 21
1
vote
0 answers

Flag Annotation overlap and interchange to each other

I am facing a problem about show multiple annotation on MKMapView. My question is that, I have three type annotation like as(select_StarFlag, simple_Flag, currentLocation_Flag). all flag are show on map but there are interchange the position…
Sankalap Yaduraj Singh
  • 1,167
  • 2
  • 14
  • 32
1
vote
1 answer

how can I get displayed titles of annotation in MKMapview?

I have displayed multiple annotations with titles on MKMapView, How can I get the title of annotations in an array which are displayed on MkMapView ? - (void)mapView:(MKMapView *)mapView didAddAnnotationViews:(NSArray *)views { for…
Vicky iOS
  • 35
  • 11
1
vote
2 answers

How can I fetch a satellite image of the MapKit location as Apple Map app does?

In my application I have an MapView with autocomplete. When user selects some place I show a pin on the map view with details button. Then I want to show a static satellite image of the place the same as Apple's map application does it. Are there…
MainstreamDeveloper00
  • 8,436
  • 15
  • 56
  • 102
1
vote
1 answer

Returning previous MKPinAnnotation coordinate from MKMapSnapShot

I have two view controllers, MapViewVC and MapDetailViewVC. I have several custom pin annotations on the MapView. When tapped, these annotations (with a certain default "altitude" view) initiate a the MapDetailVC that shows a snapshot of the…
jdlace
  • 341
  • 3
  • 8
0
votes
0 answers

How to add animation on users location mapkit

I have a map that shows the users location where the user's location is signified by a circle. I want to add an animation centered around the users location on the map, for example a radar that looks like it is searching. I have tried adding an…
0
votes
0 answers

firebase data not updating Map using mapkit annotation

i have a swift code of mapkit and array of annotations but when i tried to fetch data from firebase and append its to annotation the ui not updating,i need to fetch annotations from firebase and display as annotations i mapkit import…
0
votes
0 answers

Creating Custom Callout for MKClusterAnnotations

I am looking to make it so that every annotation in a clusterannotation when clicked on by the user will display each annotations title and a detailDisclosure button for each respective annotation that on click will lead to more info in regards to…
0
votes
1 answer

Is there a MapKit JS event to detect when the map has finished loading?

Is there a MapKit JS event to detect when the map has finished loading? The documentation does not show anything on how this is possible. Does anyone have a workaround that does not involve a setTimeout?…
SlickRemix
  • 456
  • 6
  • 17
0
votes
0 answers

How do I pass selected annotation name to UserView?

I want to pass the name of the selected annotation to another view called UserView, this is my code: struct Maps: View { @State private var showUserView = false @ObservedObject var locationFetcher = LocationFetcher() var body: some View…
user21138718