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

When to link annotation property in viewForAnnotation method

I came across this piece of code in Apple's Location and Maps Programming Guide: - (MKAnnotationView *)mapView:(MKMapView *)mapView viewForAnnotation:(id )annotation { // If the annotation is the user…
Kymer
  • 1,184
  • 8
  • 20
0
votes
1 answer

Swift 2.0: How do I specify which Annotation is pressed when having more then one Annotation? Market

I do have the problem that I do not know how to specify which UIButton .DetailDisclosure type is pressed. I do have multiple Annotations and I want to show the details of this specific Annotation. I hope that question is clear and someone can help…
Daniel
  • 3
  • 2
0
votes
0 answers

User Location overrides Pin Annotation

So I want my map to display both the users current location and the place they searched for. Here's where there are some issues. Some times when the user searches, it will load the map with their current location, they place they searched for, and…
bwc
  • 1,732
  • 1
  • 14
  • 27
0
votes
0 answers

MapKit Annotations tracing routes and using prepareForSegue

I'm using MapKit in my app and i needed drop pin an specific place and in another view controller, when will have an option to draw the route to that pin. So, i use this fantastic tutorial but i'm having trouble to pass the information with…
0
votes
2 answers

How to show user on Map using mapkit in IOS

How to show user on Map using mapkit in IOS. This code only show the India on the map instead of coordinates defined. mapView.delegate = self; mapView.showsUserLocation = YES; objLocationManager = [[CLLocationManager alloc] init]; …
Chandan Kumar Jha
  • 325
  • 2
  • 4
  • 18
0
votes
1 answer

Customising UIButtonType

I've a MKPinAnnotationView which has a leftCalloutAccessoryView that receives a UIButton. let pinView = MKPinAnnotationView() pinView.pinTintColor = UIColor.blueColor() pinView.canShowCallout = true pinView.draggable = true let button: UIButton =…
Can
  • 4,516
  • 6
  • 28
  • 50
0
votes
1 answer

Set first annotation in annotations

OK, I have an array of pubs: var pubs = [Pub(coordinate: CLLocationCoordinate2D(latitude: 43.2282385, longitude: 76.855085)), Pub(coordinate: CLLocationCoordinate2D(latitude: 43.2345965, longitude: 76.8907758)). and I add annotations to my…
aaisataev
  • 1,643
  • 3
  • 22
  • 38
0
votes
1 answer

How to add annotation manually to map view in iOS?

I'd like to add annotation manually (when user touch in to the particular place in map view) and to get the details of that location (latitude,longitude,address)..
Barani
  • 84
  • 1
  • 1
  • 12
0
votes
1 answer

Swift iOS Mapkit - Annotation not showing

Having some trouble getting the annotation to appear on the map. The address string is getting passed in from the previous ViewController. Everything working fine up to pushing the annotation to the map. Any suggestions? class PostViewController:…
baconck
  • 386
  • 2
  • 5
  • 19
0
votes
2 answers

unrecognized selector sent to instance [CustomAnnotation setTitle]

I am trying to set custom annotation title value but I got the crash report.crash report is: "Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[CustomAnnotation setTitle:]: unrecognized selector sent to…
Barani
  • 84
  • 1
  • 1
  • 12
0
votes
1 answer

show near by restaurants in Map View using user current location in map kit

In my iphone app,I have to show near by restaurants in Map View. But how can I show nearby restaurants with in 5000 meters of current location with native MKMap view(I found out my current location-lat&long) I would like to learn how to implement as…
Barani
  • 84
  • 1
  • 1
  • 12
0
votes
1 answer

Error creating multiple map annotations from a parse class

I'm trying to create annotations from Parse backend but I get an error '[PFObject]?' is not convertible to '[PFObject]' I based my code on a question i found here Query a GeoPoint from Parse and add it to MapKit as MKAnnotation? Heres a pic of my…
0
votes
2 answers

MapKit adding multiple annotations from core data

This is my code. It loops for the number records in the database but only retrieves the first records lat and lon. func fetch() { let appDel: AppDelegate = UIApplication.sharedApplication().delegate as! AppDelegate let context:…
MwcsMac
  • 6,810
  • 5
  • 32
  • 52
0
votes
1 answer

Loading new pins on MKMapView as user scrolls and zooms using AFNeworking

Initially I load 10 pins using AFNetworking and plot them on the map and set the map zoom level to fit these 10 pins, however in my database I have 1000 pins and I want to load them as the user scrolls or zooms, how would I go about doing this?
Sami
  • 1,374
  • 1
  • 16
  • 43
0
votes
1 answer

iOS MapKit MKPointAnnotation add Disclosure Button - Not showing pinpoints

On viewload I am looping over some data and adding point points: for (id venue in venues) { MKPointAnnotation *point = [[MKPointAnnotation alloc] init]; point.coordinate = coords here; point.title = @"title" …
aherrick
  • 19,799
  • 33
  • 112
  • 188