【问题标题】:dismissViewControllerAnimated close all view controller to root [swift]dismissViewControllerAnimated 关闭所有视图控制器到根 [swift]
【发布时间】:2016-03-04 11:30:37
【问题描述】:

假设我有 4 个视图控制器

第 1 页 ----showdetail----> 第 2 页 ----showdetail----> 第 3 页 ----showdetail----> 第4页

我想用self.dismissViewControllerAnimated(true, completion: nil) 从第 4 页回到第 3 页。它在 iOS 9 中运行良好,但是当我在 iOS 8 设备中尝试时,它会将所有视图控制器关闭到第 1 页

【问题讨论】:

  • 你从哪里打电话给dismissViewControllerAnimated
  • 你为什么使用 showdetail segue 类型?您显示 segue 类型并使用以下代码。 self.navigationController?.popToRootViewControllerAnimated(true)
  • showdetail segue 是一种替换视图控制器..
  • @showdetail 我首先使用'show',当我意识到 ios 8 的错误时我更改为 showdetail。好的,我试试看
  • 你在使用 NavigationController 吗?要仅弹出一个视图,您可以执行[self.navigationController popViewControllerAnimated:YES]

标签: ios swift uiviewcontroller


【解决方案1】:

您可能希望使用Present Modally segue 而不是Show Detail。这里对每种segues都有很好的解释What's the difference between all the Selection Segues?

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2018-04-29
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-07-27
    • 1970-01-01
    相关资源
    最近更新 更多