I want to add title and sub Titles to the annotations added on the Mk map view , i am adding the annotations depending on the current location of the user (storing the latitude and longitude values in the core data table) annotations are adding in the correct way as i want but my problem is i need to get the title and sub title for those respective annotations , i have values for title and subtitle (getting through place mark class). i am getting same title and subtitle to all the pins. How can i customize title and subtitle to the respective annotations?? Please guide me i am newbie Thanks in advance.
Asked
Active
Viewed 909 times
2 Answers
0
When you call [mapView addAnnotation:annotation]
you need to make sure that the annotation has a title and subtitle, here's a quick example:
MyAnnotation *anno = {create your annotation here};
anno.title = @"Title 1";
anno.subtitle = "@subtitle 1";
[mapVoew addAnnotation:anno];
Since I don't know how you are creating your annotations or where you get the titles from I will leave that up to you to figure out. If you can figure out how to make multiple annotations have their correct locations then you should be able to work out how to get the matching titles at the same time.

Craig
- 8,093
- 8
- 42
- 74
0
MKAnnonation *obj=[[MKAnnonation alloc]init];
obj.title = @"Title 1";
obj.subtitle = "@subtitle 1";

Pradnya
- 7
- 1
-
This is pretty much just a repeat of [this existing answer](http://stackoverflow.com/a/14695236). – Pang Feb 24 '17 at 06:57