iphone - Drop pin in center of the map -


how drop pin in center of map?

you first need create class implements mkannotation protocol; "data" of annotation (pin) , has little visual representation. can create instance of class, set coordinate centre of map, add mkmapview, , render using mkpinannotationview instance.

// in view controller, assuming you've created "myannotation" class. - (void)viewdidload {   [super viewdidload];    myannotation *annotation = [[[myannotation alloc] init] autorelease];   annotation.coordinate:self.mapview.centercoordinate;   [self.mapview addannotation:annotation]; }  - (mkannotationview *)mapview:(mkmapview *)mapview     viewforannotation:(id <mkannotation>)annotation {   // remember reuse annotation views calling mkmapview's   // dequeuereusableannotationviewwithidentifier:!   return [[[mkpinannotationview alloc] initwithannotation:annotation       reuseidentifier:@"string"] autorelease]; } 

Comments