Create a Pin object MAPointAnnotation *pointAnnotation = [[MAPointAnnotation alloc] init]; //where to insert the pin pointannotation.coordinate = cllocationcoordinate2dmake (39.989631, 116.481018); //pin title pointannotation.title = @ "Fang Heng International"; //pin sub-title pointannotation.subtitle = @ "No. 6th, Fu Tong East Street"; [_mapview addannotation: Pointannotation];//The following methods can make the map pin pop-up bubble- (maannotationview *) Mapview: (mamapview *) mapview Viewforannotation: (id <maannotation>) annotation{ if ([annotation Iskindofclass:[mapointannotation class]]) { static nsstring *pointreuseindetifier = @ "Pointreuseindetifier"; MAPinAnnotationView*annotationView = (mapinannotationview*) [mapview dequeuereusableannotationviewwithidentifier:pointreuseindetifier]; if (Annotationview == nil) { annotationview = [[mapinannotationview alloc] initWithAnnotation:annotation reuseIdentifier:pointReuseIndetifier]; } annotationview.canshowcallout= yes; //set bubbles can pop up, default is no annotationview.animatesdrop = yes; //Set the callout animation display, Default is no annotationview.draggable = yes; //setting annotations can beDrag, default to no annotationview.pincolor = mapinannotationcolorpurple; return annotationview; } return nil;} Use coordinate information to judge you didn't say the exact effect you wanted I'll tell you one. suppose you have n pins on the map In fact, that is, n pointannotation you can get to directly by _mapview.annotations This is the array in the method of clicking the Pin- ( void) Mapview: (bmkmapview *) Mapview didselectannotationview: (bmkannotationview *) View{NSArray * array = [nsarray arraywitharray:_mapview.annotations]; for (int i=0; i<array.count; i++) { if (view.annotation.coordinate.latitude == (bmkpointannotation*) array[i]). Coordinate.latitude) &NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSp { //gets to the current pin You can do some things } else { //operation of the remaining pins I was deleting //[ _mapview removeannotation:array[i]]; } }}
This article is from the "zhuoking" blog, make sure to keep this source http://9951038.blog.51cto.com/9941038/1764185
Add multiple pins on the Ios gold map How do I know which pin I clicked in the multiplexing queue?