【问题标题】:Multiple segues to one UIViewController一个 UIViewController 的多个 segues
【发布时间】:2016-03-06 13:41:14
【问题描述】:

在我的故事板中,我有一个 TextInputViewControllerUIViewController 的子类)。我有多个推送 segues 导致 TextInputViewController 具有来自各种视图控制器的不同标识符。然而,每次调用这些 segue 中的一个时,它们似乎都会转到 TextInputViewController 的同一实例,这会导致非常奇怪的行为。 有没有办法让每个 segue 创建一个不同的 TextInputViewController 实例?

【问题讨论】:

  • Segues 创建destinationViewController 的新实例。您看到什么行为让您认为他们使用的是同一个实例?
  • 非常感谢您指出这一点,您是对的,问题似乎出在其他地方。把它写成答案,我会标记它

标签: ios swift uiviewcontroller storyboard


【解决方案1】:

Segues 总是创建destinationViewController 的新实例(unwind segue 除外,它只是简单地返回到先前创建的 viewController)。

您看到的行为一定是由 viewController 外部的一些其他状态引起的,因为它是一个新实例。

You can read more about using Segues here.

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2014-10-06
    • 1970-01-01
    • 2012-09-30
    • 1970-01-01
    • 2018-08-12
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多