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

Remove MKAnnotationView Default Callout From View

I am trying to prevent MKMapKit from presenting the default annotation callout when tapping on a marker displayed on a MKMapView without blocking the delegate call / interaction of the annotation (seen below). - (void)mapView:(MKMapView *)mapView…
Will Von Ullrich
  • 2,129
  • 2
  • 15
  • 42
1
vote
1 answer

Multiple mapView in one app

I'm creating business app which is using mapView for almost all functions. Now I'm considering, is it ok to use two mapView in one app? To be more specific - I've created mapView and I've made some creations (like annotations etc.). Is it ok to…
xxcat
  • 127
  • 7
1
vote
1 answer

Request with Alamofire and Mapkit Swift 3

I'm using Alamofire to request data from server, then use these data to show location on map. When panning or zooming map, it required to request API and reload the map. The current issue is that whenever zooming or panning, CPU > 100% lead to the…
Manh N.
  • 31
  • 2
1
vote
1 answer

FBAnnotationClustering remove annotation in swift

I am using FBAnnotationClustering cocoa pod library in my application to do the clustering. In this removeAllAnnotation method is only available in Objective-C but not in swift 3. So I am posting the swift version to help others like me. Please see…
Saranya
  • 163
  • 2
  • 10
1
vote
1 answer

Custom callout view with xib

I'm trying to set a custom callout view with a xib I created however it doesn't show up. My xib LocationInfo looks like this I've created a custom uiview class for the view in my xib to set a background image (not sure if this works since I haven't…
NoSixties
  • 2,443
  • 2
  • 28
  • 65
1
vote
1 answer

iOS MapKit - Detect when map is fully zoomed in?

So I am using a clustering library to group annotations and there is a small bug with it whereby some very close together annotations can appear grouped when the map is fully zoomed in. With this being a framework I can't do much about it directly…
Jacob King
  • 6,025
  • 4
  • 27
  • 45
1
vote
1 answer

MapKit annotation how to add detail disclosure info button?

I am putting annotation on a map and after clicking the pin, there should be a detail disclosure info buttonon the right side, so I can add more code after tapping the button. But when I run the project, clicking on the pin, there is no info…
developermike
  • 625
  • 9
  • 17
1
vote
1 answer

how to get location name from default annotations Mapkit in iOS

How can I get the locations' name from Mapkit's default location points in iOS. I want to click on it(ex.Swiss Hotel) and get name in Swift
Arda
  • 407
  • 5
  • 14
1
vote
1 answer

How to Increase the Radius of userLocation Annotation in Mapkit

My app takes user permission and move the map to the location. And at that position by default MapKit add a blue icon which is generating some pulse. I've searched around but I found how to add a 1000m circle around userLocation. I don't want that.…
Chaudhry Talha
  • 7,231
  • 11
  • 67
  • 116
1
vote
1 answer

swift mapkit annotations repeating the same CalloutAccessoryView image

I try to make a simple map with annotations,but when I try to run it, the images of detailCalloutAccessoryView are the same, but I'm sure I put two different images, How did this happen? Or does anyone have a better way to do this? var…
Johnny Hsieh
  • 856
  • 2
  • 10
  • 23
1
vote
6 answers

Default location in map-kit in ios

I am new to IOS i need to show default location with my latitude and longitude(12.940358, 80.208647). with annotation pin. .h file: #import #import #import @interface Map_view :…
A.sonu
  • 159
  • 10
1
vote
1 answer

Do not remove all annotations on my map

I have this button, that should show/hide certain annotation pins on my map. I have this function down below, but when you press it to remove the pins, it removes all pins. It should only remove the pins that are inside the addAttractionPinsBilka?…
Mus Harlem
  • 185
  • 4
  • 19
1
vote
1 answer

Using MKCircle to detect if CGPathContainsPoint in Swift 2.0

I'm trying to detect if a Map Annotation is inside an MKCircle. I have tirelessly traversed the internet with little luck of finding a solid tutorial of this for Swift 2.0. All tutorial or Stack Overflow questions are answered with deprecated code…
Ivan
  • 665
  • 2
  • 10
  • 28
1
vote
1 answer

Passing coordinates of selected Annotation to new View Controller Swift 2.0

I am trying to pass the coordinates, title, and subtitle of a selected MKAnnotation from ViewController1 (VC1) to ViewController2 (VC2) when the DetailDisclosure button of rightCalloutAccessoryView is tapped. I have a segue from VC1 to VC2 with the…
Ivan
  • 665
  • 2
  • 10
  • 28
1
vote
3 answers

Preventing annotation deselection in MKMapView

I have a situation in my app where I want to disable annotation deselection (other than when selecting another), so when I tap anywhere that is not an annotation view, it should leave the currently selected annotation as is. If I tap on another…
noizybrain
  • 155
  • 1
  • 15