【问题标题】:UINavigationController return to first viewUINavigationController 返回第一个视图
【发布时间】:2011-04-08 21:52:12
【问题描述】:

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

我使用什么代码返回以关闭当前视图并滑回我的第一个视图?我需要与 [superdismissModalViewControllerAnimated:true] 等价的东西;但显然这不是模态视图。

谢谢。

【问题讨论】:

    标签: iphone uitableview uinavigationcontroller


    【解决方案1】:

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

    popViewControllerAnimated:
    popToRootViewControllerAnimated:
    popToViewController:animated:
    

    当然取决于你想如何处理它。通常只使用第一种方法返回到最后一个视图(将当前视图推送到导航堆栈的那个)。

    【讨论】:

    • 谢谢,这真的很有帮助!
    【解决方案2】:

    在 UINavigationController 中使用 popToRootViewControllerAnimated 方法:

    [self.navigationController popToRootViewControllerAnimated:animated];
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多