gpt4 book ai didi

ios - 在 Apple Watch 的 "ExtensionDelegate"设置 rootInterfaceController

转载 作者:可可西里 更新时间:2023-11-01 03:34:09 24 4
gpt4 key购买 nike

我正在制作一个 Apple Watch 应用程序,我想根据初始条件设置不同的 Root View Controller 。

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

你有什么好的建议吗?也许通过 Storyboard?

最佳答案

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

创建一些带有启动画面的 SplashController,并在 awakeWithContext

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

跟踪你需要的东西,比如在跟踪之后呈现一些 Controller

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

isCounting 存储在 NSUserDefaults 中

希望这会有所帮助:)

关于ios - 在 Apple Watch 的 "ExtensionDelegate"设置 rootInterfaceController,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37525642/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com