【问题标题】:I can't perfom my segue in navigationController in Swift3我无法在 Swift 3 的 navigationController 中执行我的 segue
【发布时间】:2017-10-16 14:06:47
【问题描述】:

我有 4 页。

我的第一页,我选择我的提供者并为我的 navigationController 执行我的 segue,

我的第二页,只是我的 UINavigationController,

我的第三页,做了一些工作,当它结束时,调用此行

performSegue(withIdentifier: "GoToMainPageStat", sender: nil) //go to my last page

我的最后一页,有一个用于断开此帐户的按钮,我使用此行退出所有 UINaviationView self.navigationController?.dismiss(animated: true, completion: nil)

此时一切正常,但是当我想再次连接时,它不会在第 3 步执行我的 segue。 我在之前和之后放置了调试日志,日志被执行但不是我的 performForSegue。

【问题讨论】:

  • '我的第三页,做了一些工作,当它结束时,调用这条线' -> 我是否理解正确,你实现了一个 VC 只是为了加载屏幕?为什么不跳过第 3 页并将加载指示器放在第 4 页上?
  • 第三页做一些ajax,请求我不能在第4页做这个
  • 如何呈现这些页面?通过推送它们或将它们作为弹出窗口显示在彼此之上?
  • @MauricioChirino 我推他们
  • 那么你不应该使用这个self.navigationController?.dismiss(animated: true, completion: nil)指令。相反,使用navigationController?.popController(animated: true, completion: nil)

标签: swift swift3 uinavigationcontroller segue uistoryboardsegue


【解决方案1】:

你确定,你在主线程中执行 segue 吗?如果不移动到主线程。

DispatchQueue.main.async {
               self.performSegue(withIdentifier: "GoToMainPageStat", sender: nil)
}

【讨论】:

  • 我确定,我执行了 segue,因为我在 prepareForSegue 中进行了调试
  • prepareForSegue 将被调用,无论您在哪个线程中执行 segue。请检查并确认。
猜你喜欢
  • 2015-11-18
  • 1970-01-01
  • 2018-03-10
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2014-10-01
  • 2017-05-18
相关资源
最近更新 更多