在我的 iphone 应用程序中,我有一个带有视图和 MKMapView 的控制器。
我在地图上显示了几个注释,但是当我单击注释视图时,“calloutAccessoryControlTapped”被触发,但我无法推送新视图。
self.navigationView 为空……最好的方法是什么?我是否需要在 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];
}
}