2010-09-06 43 views
9

我正在使用UINavigationController从UITableViewController滑动到另一个视图。在第二个视图中,我创建了一个附加到动作的自定义“后退”按钮。UINavigationController返回到第一个视图

我使用什么代码返回以关闭当前视图并回到第一个视图?我需要的东西等同于[super dismissModalViewControllerAnimated:true];但显然这不是一种模态观点。

谢谢。

回答

16

看看你的导航控制器上的以下三种方法之一:

popViewControllerAnimated: 
popToRootViewControllerAnimated: 
popToViewController:animated: 

根据您要如何处理,当然它。通常,只使用第一种方法返回到最后一个视图(将当前视图推送到导航堆栈的视图)。

+0

谢谢,这真是帮了! – 2010-09-06 20:26:20

+0

没问题,很高兴我能帮上忙 – jer 2010-09-06 20:26:33

9

使用popToRootViewControllerAnimated方法的UINavigationController:

[self.navigationController popToRootViewControllerAnimated:animated]; 
相关问题