MKMapView doesn't want to call didAddAnnotationViews method

Posted by TheLearner on Stack Overflow See other posts from Stack Overflow or by TheLearner
Published on 2010-05-30T17:59:27Z Indexed on 2010/05/30 18:02 UTC
Read the original article Hit count: 634

Filed under:
|
|

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;

}

© Stack Overflow or respective owner

Related posts about objective-c

Related posts about iphone-sdk