MKMapView not calling delegate methods
- by criscokid
In a UIViewController I add a MKMapView to the view controlled by the controller.
- (void)viewDidLoad {
[super viewDidLoad];
CGRect rect = CGRectMake(0, 0, 460, 320);
map = [[MKMapView alloc] initWithFrame:rect];
map.delegate = self;
[self.view addSubview:map];
}
Later in the controller I have
- (void)mapViewDidFinishLoadingMap:(MKMapView *)mapView
{
NSLog(@"done.");
}
Done never gets printed. None of the other delegate methods get called either like mapView:viewForAnnotation: I use a MKMapView in an another app, but this seems to happen on any new application I make. Has anyone else seen this behavior?
EDIT:
The problem seems to be when UIViewController is made the delegate of the MKMapView, a direct subclass of NSObject seems to work okay. I can work around like this, still seems very odd since I've done it before.