在我的iphone应用程序中,我有一个带视图的控制器和MKMapView
我在地图上显示了几个注释,但是当我点击注释视图时,会触发“calloutAccessoryControlTapped”,但我无法推送新视图。
self.navigationView为null ...这样做的最佳方法是什么?我是否需要在MKMapView上创建导航控制器?
-(void)mapView:(MKMapView *)mapView annotationView:(MKAnnotationView *)view calloutAccessoryControlTapped:(UIControl *)control
{
NSLog(@"annotation clicked"); // => OK
if ([control isKindOfClass:[UIButton class]]) {
NSLog(@"annotation clicked 2"); // => OK
// Get annotation as some stuff needs to be passed to the new view
MyAnnotation *annotation = (MyAnnotation*)view.annotation;
ControlViewController *controlViewController = [[ControlViewController alloc] initWithNibName:@"ControlViewController" bundle:nil];
controlViewController.thing = annotation.thing;
NSLog(@"self.navigationController:%@", self.navigationController); // => null
// [self.navigationController pushViewController:controlViewController animated:YES];
[controlViewController release];
}
}