【问题标题】:Set rootInterfaceController in Apple Watch's "ExtensionDelegate"在 Apple Watch 的“ExtensionDelegate”中设置 rootInterfaceController
【发布时间】:2016-05-30 12:25:35
【问题描述】:

我正在制作 Apple Watch 应用,我想根据初始条件设置不同的根视图控制器。

虽然我不能直接设置 WatchKit rootInterfaceController,因为它是一个只读属性,但是通过检查Apple documentation,他们说可以“在启动序列完成之前”设置它。

你有什么好的建议吗?也许通过故事板?

【问题讨论】:

  • 不能设置只读属性!!

标签: ios storyboard apple-watch wkinterfacecontroller


【解决方案1】:

你不能设置只读属性,你可以这样做,

创建一些 SplashController,带有一些启动屏幕,并在 awakeWithContext

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

跟踪你需要的东西,例如在跟踪一些控制器之后

   if !isCounting {
    self.presentControllerWithName("Interface", context: nil)
} else {
    self.presentControllerWithName("Timer", context: nil)
}

isCounting 存储在 NSUserDefaults 中

希望这会有所帮助:)

【讨论】:

    猜你喜欢
    • 2016-04-23
    • 1970-01-01
    • 1970-01-01
    • 2017-03-25
    • 1970-01-01
    • 2015-11-14
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多