【问题标题】:WatchKit how do I perform a specific segue with an identifierWatchKit如何使用标识符执行特定的segue
【发布时间】:2017-02-09 16:19:54
【问题描述】:

我有一个已经连接在 InterfaceBuilder 中的按钮,用于调出模态界面控制器。在某些情况下,我想以编程方式触发此转换,但我找不到在 Watchkit 中执行相同转场的方法。我知道你可以在 iphone/iOS 中做到这一点,但到目前为止我在 Watchkit 中找不到它。

【问题讨论】:

    标签: segue watchkit apple-watch


    【解决方案1】:

    它可以以编程方式完成。您需要在 StoryBoard 中为界面设置 Identifier。

    如果你希望它以模态方式呈现

    presentControllerWithName("Identifier", context: nil)
    

    如果你想推

    pushControllerWithName("Identifier", context: nil)
    

    您可以根据需要设置上下文。您可以在您推送/呈现的控制器中检索它

    override func awakeWithContext(context: AnyObject?) {
        super.awakeWithContext(context)
    }
    

    【讨论】:

      【解决方案2】:

      新来电:

      presentController(withName: "Identifier", context: nil)
      pushController(withName: "Identifier", context: nil)
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2018-09-13
        • 2012-06-20
        • 2018-02-25
        • 2015-07-24
        • 2018-08-24
        相关资源
        最近更新 更多