我想,当用户点击一个注解推看法,我在的地方下面的代码:上的注释时,点击推视图
- (void) mapView: (MKMapView *) mapView annotationView:(MKAnnotationView *) view calloutAccessoryControlTapped:(UIControl *) control
{
childController = [[NeighborProfileViewController alloc] initWithNibName:@"NeighborProfileViewController" bundle:nil];
childController.title = view.annotation.title;
childController.uid = [((NeighborMapAnnotation *)(view.annotation)) uid];
[self.navigationController pushViewController:childController animated:YES];
}
我知道这个代码片段内执行因为我试图打印出一些东西,而且确实打印出来了。然而,为什么它不改变我已经推动的观点?
这是因为这个视图实际上是主视图的子视图,它实际上有导航控制器?如果是这种情况,那我该如何解决这个问题。下面是加载子视图代码:
-(IBAction) toggleAction:(id) sender {
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:1.0];
[UIView setAnimationTransition:UIViewAnimationTransitionCurlUp forView:self.view cache:YES];
if(self.navigationItem.rightBarButtonItem.title == @"List"){
self.navigationItem.rightBarButtonItem.title = @"Map";
[mapViewController.view removeFromSuperview];
}else {
[self.view addSubview:mapViewController.view];
[self.view sendSubviewToBack:self.view];
self.navigationItem.rightBarButtonItem.title = @"List";
}
[UIView commitAnimations];
}
换句话说calloutAccessoryControlTapped是的MapViewController
xib是正确的,代码是一样的确切的事情,我用来推一个控制器时,用户在表视图 – aherlambang 2011-02-02 04:24:44