【问题标题】:Move from one interface controller to another on从一个接口控制器移动到另一个
【发布时间】:2020-06-11 20:03:46
【问题描述】:

我正在尝试在接口控制器中设置倒数计时器,当时间为 0 时,我希望它对下一个接口控制器执行 segue。

有什么办法吗?

    if secondsLeft == 0 {
        pushController(withName: "RunGameInterfaceController", context: nil)

【问题讨论】:

    标签: swift xcode segue watchkit wkinterfacecontroller


    【解决方案1】:

    尝试使用 main.storyboard 在两个控制器之间创建一个 segue。

    然后,给 segue 一个标识符。这可以在“Storyboard and Segue”选项卡下的右侧栏菜单上完成。

    在您的代码中,而不是使用“pushController”

    使用 "self.performSegue(withIdentifier: "yourSegueName", sender: self)"

    确保将“yourSegueName”替换为您的标识符,然后您就可以开始使用了!

    【讨论】:

      猜你喜欢
      • 2012-04-28
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-07-23
      相关资源
      最近更新 更多