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

Image annotation different

I created a map view with different annotation and a search. I can not attribute a different image according to the pin. I also have another concern, when I do a search it removes a pin to put it on the new place sought. Below is the code of a young…
SWOON
  • 19
  • 7
0
votes
1 answer

How to prevent overlap of UIImage based on polyline in Swift?

I am currently working in Swift 3 and I ran into problems trying to create a flag splitting project for an app I am helping create in my Grade 12 programming class. I was trying to have a polyline splitting two maps. An example is pictured/attached…
0
votes
1 answer

iOS MapKit Annotations Not All Added

In my app, I get the latitude and longitude along with some other data from a Parse query. However, only about 100 annotations get added, when there should be 156. I verify in console that it is getting the coordinates for the missing pieces on…
0
votes
1 answer

MapKit custom annotation view causing crashes

I created a custom AnnotaionView which displays a number. The code causing the most problem seems to be in the layout. class NumberAnnotationView: MKAnnotationView { private var __number: Int private var textLayer: CALayer! private var…
Shane Hsu
  • 7,937
  • 6
  • 39
  • 63
0
votes
0 answers

App freezes then crashes on all iPhones but runs on simulator

This json is loading restaurants by taking state and city of USA and showing it on Map with Markers along with address and restaurant name. This App works on Simulator but doesn't run on iPhones and iPods when it searches the restaurant. …
Kada
  • 63
  • 8
0
votes
1 answer

iOS 9: MapView with multiple Annotations inside a UITableViewCell

Context: I am working on a TableView which contains many different cells: One of them should contain a MapView with multiple annotations in it. What I have got so far: //address comes in this format: NSString = @"myStreet myNumber, myZIP myCity,…
Tim
  • 175
  • 1
  • 1
  • 12
0
votes
1 answer

Make Custom Annotations tappable

I do not understand how to make my custom map annotations tapable. This is the code that generates the annotations: import UIKit import MapKit import CoreLocation class NeighbourhoodMapCell: UITableViewCell { var userList : NSMutableArray? …
Rutger Huijsmans
  • 2,330
  • 2
  • 30
  • 67
0
votes
1 answer

Changing CustomCallout Bubble Height in MapView - iOS

I am having custom Annotation and it's calloutbubble having the view in which the table is there which height is 200. But while setting it in callout bubble it will not effect the size of callout bubble How can i achive this? Here is my code…
0
votes
1 answer

How to change proximity of user location annotation

How to change the proximity of which a userLocation annotation generates. I'm talking about the faded blue circle the userLocation annotation is creating around it. How can I change it's radius?
Chaudhry Talha
  • 7,231
  • 11
  • 67
  • 116
0
votes
1 answer

why should I have to zoom out to see the annotation in mapview in iOS, objective c

I'm implementing a map view specific location with longitude and latitude.like below. self.hotelmapView.showsUserLocation = YES; self.hotelmapView.showsBuildings = YES; locationManager = [CLLocationManager new]; if ([locationManager…
caldera.sac
  • 4,918
  • 7
  • 37
  • 69
0
votes
1 answer

iOS: How to offer directions from annotation view?

Basically what I'm wondering is how to offer the user an option to get directions in Maps from an annotation (like that little car icon inside of the annotation that opens up directions)
0
votes
1 answer

Custom MKAnnotation View

I'm doing a MapView in Swift and I would like to add more "label" on the Annotation view or at least the Title and Subtitle to not be cut (see image). Can someone help me?
0
votes
1 answer

Custom annotation showing same image for all different types of POI's

I need to show different annotation for different cat_ID on map. in this question i am including only two categories . let item = json["data"].arrayValue var count = 0 initMK() dispatch_async(dispatch_get_main_queue()) { while…
Krishna Kumar Thakur
  • 1,456
  • 12
  • 27
0
votes
1 answer

How do i connect the two annotation points?

I passed the two values fromAddress text field and toAddress text fields and i need to connect the two annotation points like a route. I don't need any directions based on the api's. Just need to connect. import UIKit import MapKit import…
Praveen Kumar
  • 298
  • 2
  • 15
0
votes
1 answer

What is the best way to implement a custom MKAnnotationView when someone sets a pin using Swift?

When user clicks on a pin, the MKAnnotationView comes up, but it is very limited. I created a custom button but is there a way to customize the entire view that comes up from the pin? Here is what I have so far. func mapView(mapView: MKMapView,…
IvOS
  • 323
  • 3
  • 13