更改监视套件中的初始接口控制器



>我有两个接口控制器,controller1.swiftcontroller2.swift

这些与按钮操作后)连接。但在某些情况下,我需要跳过controller1并只显示controller2.在iOS应用程序中,我在appDelegate,设置rootViewcontroller等中执行此操作。在Apple Watch Extension中执行此操作的方法是什么?

任何指导或帮助?

let rootControllerIdentifier = "FirstInputInterfaceController"
WKInterfaceController.reloadRootControllers(withNames: [rootControllerIdentifier], contexts: nil)

斯威夫特 4:

let rootControllerIdentifier = "FirstInputInterfaceController"
WKInterfaceController.reloadRootControllers(withNamesAndContexts: [(name: rootControllerIdentifier, context: [:] as AnyObject)])

经过长期的研究工作,我只发现了一个解决方案 - 创建一些带有一些启动画面的 SplashController,并在

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

跟踪您需要的东西,跟踪后呈现一些控制器,示例

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

希望它能帮助某人。P.S. isCounting存储在NSUserDefaults中

最新更新