Questions tagged [mkannotation]

An Apple protocol, for model object representing a point on a map view

An object that adopts this MKAnnotation protocol manages the data that you want to display on the map surface. It does not provide the visual representation displayed by the map. Instead, your map view either registers particular classes for annotations or the delegate provides the MKAnnotationView objects needed to display the content of your annotations. When you want to display content at a specific point on the map, add an annotation object to the map view. When the annotation’s coordinate is visible on the map, the map view asks its delegate to provide an appropriate view to display any content associated with the annotation.

There is basic MKPointAnnotation class that is useful if you do not need to add your own custom properties to an annotation.

If you do implement your own object to conform to MKAnnotation, there are a few considerations:

  1. If you want your map to respond to changes to the coordinate, title, or subtitle of the annotation object, make sure to make these conform to KVO (e.g., in Swift, declare them as dynamic).

  2. Probably obvious, but if the annotation views are configured to be draggable, you will want to make the coordinate mutable.

See also

1277 questions
0
votes
1 answer

Cannot push a new view when clicking on annotation view

In my iphone app, I have a controller with a view and MKMapView. I display several annotation on the map, but when I click on the annotation view the "calloutAccessoryControlTapped" is triggered but I'm not able to push a new…
Luc
  • 16,604
  • 34
  • 121
  • 183
0
votes
0 answers

How to send object in MKAnnotation?

I want to send object when user taps on pin. I know only how to send title but this is not enough because some titles are same. This is my code: ... - (void)viewDidLoad { [super viewDidLoad]; if (context == nil) { context =…
iWizard
  • 6,816
  • 19
  • 67
  • 103
0
votes
1 answer

How to change title for annotation in ViewDidLoad?

I have code for mkannotation but I don't know how to change title in ViewDidLoad. This is my code: LocationView.h ... @interface AddressAnnotation : NSObject { CLLocationCoordinate2D coordinate; NSString *mTitle; NSString…
iWizard
  • 6,816
  • 19
  • 67
  • 103
0
votes
2 answers

How to create custom annotation and callout in iphone

I want to create a custom annotation and callout on MKMapView. I have to create annotations with bigger in size and have to display three or four lines of text(labels). So how to create a custom annotation and callout bubble. Thanks in…
ashishraval
  • 53
  • 1
  • 6
0
votes
1 answer

Determine which MKPinAnnotationView was selected?

I place some custom MKPinAnnotationView on the map, with different information about landmarks (name, description, image, accessory button). When a user click and open one of the pins, and then click the accessory button inside it, I want to know…
BlackMouse
  • 4,442
  • 6
  • 38
  • 65
0
votes
2 answers

MKAnnotations not reloading correctly

Having trouble with MKAnnotation. Have a custom pinview and works fine for the first loading. Go to remove pins and then reload same pins they change colors. Im adding pins from two different DB's and works just fine. Once removed and then add…
0
votes
1 answer

iphone Detect selected MKPinAnnotation in a MapView

I have a custom MKPinAnnotation in which I have added a couple of peroperties , like the Id of the object and the type. What I want is when someone selects a pin in the MapView to detect which pin is selected and get that data. And Show a button…
Panos
  • 7,227
  • 13
  • 60
  • 95
0
votes
2 answers

Perform backend operations on MKPointAnnotation

I have populated a couple of locations on MKMapView using MKPointAnnotation(s). On tapping annotations I am showing some options with UIActionSheet menu. The options have some delete functionality which would delete the selected annotation on map…
Firdous
  • 4,624
  • 13
  • 41
  • 80
0
votes
2 answers

Xcode Annotation from Property List

i know that similar questions have been already asked, but i just could find the answer. So, I'm building an app that has over 100 Pins, writing it into the implementation would be just to much. Does anybody know from your previous experience how…
dsafa
  • 783
  • 2
  • 8
  • 29
0
votes
1 answer

trigger call out bubble after searching in ios 5

I have a searchbar in my view which is to be used by users to enter a keyword and searching according to that. I am using uisearchbar delegate for this. Right now the map is coming in center for which the keyword is being searched for, but I also…
Maverick
  • 2,738
  • 24
  • 91
  • 157
0
votes
1 answer

How do I display annotations titles for an array of locations on MapKit

I'm filtering some Google Places data and then displaying each location on a map view. currently I have all the points displaying on the map. I need to figure out how to show a annotationPoint.title = place.name; for each of these locations. Any…
hanumanDev
  • 6,592
  • 11
  • 82
  • 146
0
votes
1 answer

Custom MKAnnotationView stopped working after enabling ARC

I had custom MKAnnotationView implemented and it worked correctly before enabling ARC. initWithAnnotation method was implemented like this: - (id)initWithAnnotation:(id )annotation reuseIdentifier:(NSString *)reuseIdentifier { …
Misha
  • 5,260
  • 6
  • 35
  • 63
0
votes
1 answer

MKAnnotationView - MKAnnotation Parameter Warnings

I currently have a map view that is populated with several objects following the MKAnnotation protocol. There is two separate types of objects, stores and competitors. The different objects have different types of data attached to them. When the…
Kyle
  • 14,036
  • 11
  • 46
  • 61
0
votes
2 answers

MKAnnotations not showing up until I scroll the map

Well, I have a view with a map where I load some annotations. Everything works fine, but when I want to erase those annotations and include other annotations they do not show up until I move (scroll) the map. Any suggestion? EDITED: Seems like…
sergiocg90
  • 489
  • 2
  • 11
  • 24
0
votes
1 answer

MKAnnotation doesn´t trigger pin point draw method

I´m creating a view with a Map and an annotation using the following class: #import #import @interface ContactDetailAnnotation : NSObject - (id) initWithLatitude:(CLLocationDegrees) lat…
bruno
  • 2,154
  • 5
  • 39
  • 64