Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

WSD

macrumors newbie
Original poster
Jan 6, 2010
3
0
I need to add annotations long after mapView has loaded. I try to do the following:
Code:
//I call a method in mapView Controller
-(void)showAnnotation {

Basic_annotation *annotation = [[[Basic_annotation alloc] initWithCoordinate:myCoords title:@"alert"] autorelease];

[mapView addAnnotation:annotation];
}

//This, in turn, calls the delegae method
- (MKAnnotationView *) mapView:(MKMapView *)mapView viewForAnnotation:(id <MKAnnotation>) annotation

All seems well during the debugging but the annotation dont show on the map.
I tried adding (to the showAnnotation method):
Code:
	[mapView setRegion:mapView.region animated:TRUE];
	[mapView regionThatFits:mapView.region];

But, still, no results.
In the documenatation I see addAnnotation method called only during loading of the view. Is there a way to add annotation AFTER the view has loaded?
Help is much appreciated...
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.