2011-12-01 76 views
1

我目前增加点击一个mapkit注释当一个新的观点:iPhone - 删除新的导航

-(IBAction)showDetails:(id)sender{ 


DetailViewController *dvc = [[DetailViewController alloc] init]; 
dvc.title = ((UIButton*)sender).currentTitle; 

UINavigationController *navigationController = [[UINavigationController alloc] initWithRootViewController:dvc]; 
[self presentModalViewController:navigationController animated:YES]; 
} 

我想什么做的是对新观点是有一个返回按钮,将删除该视图并再次显示mapkit。

我在普通的应用程序中使用了一个tabbar。我已经安装上新的视图按钮,并试图此:

- (IBAction)backToMap:(id)sender { 
UINavigationController *nc = [self navigationController]; 
NSLog(@"%@", [nc viewControllers]); 
[nc popViewControllerAnimated:NO]; 
NSLog(@"%@", [nc viewControllers]); 
[nc popToRootViewControllerAnimated:NO]; 
NSLog(@"Close"); 
} 

但它没有任何视觉上的差异。

帮助赞赏。

回答

2

您需要关闭此模式的viewController:

- (IBAction)backToMap:(id)sender { 
    [self dismissModalViewControllerAnimated:YES]; 
} 
1

干草马克您可以尝试

[self.parentViewController dismissModalViewControllerAnimated:YES];