MKMapView doesn't want to call didAddAnnotationViews method
- by TheLearner
I am writing a little map kit app but it doesn't want to call the delegate method didaddannotationviews:
(void)mapView:(MKMapView *)mv didAddAnnotationViews:(NSArray *)views
{
//Get the first MKAnnotationView from the views returned
MKAnnotationView *annotationView = [views objectAtIndex:0];
//Get the annotation from the first annotation view and save it in a variable which can hold any object as long as it implements mkannotation
id <MKAnnotation> mp = [annotationView annotation];
//Create a region
MKCoordinateRegion region = MKCoordinateRegionMakeWithDistance([mp coordinate], 250, 250);
//As the mapview to animate i.e. display the region
[mv setRegion:region animated:YES];
}
@interface WhereAmIAppDelegate : NSObject
{
UIWindow *window;
CLLocationManager *locationManager;
IBOutlet MKMapView *mapView;
IBOutlet UIActivityIndicatorView *activityIndicator;
IBOutlet UITextField *locationTitleField;
}