当presentController(withNames:contexts :)被执行时,如何显示数组的第二个屏幕

时间:2017-06-26 22:45:45

标签: swift xcode swift3 watchkit wkinterfacecontroller

presentController(withNames:["ScreenOne", "ScreenTwo", "ScreenThree"], contexts:nil)

执行上述行时,ScreenOne屏幕显示如下:

first page in the array is highlighted

如何在执行上述行时显示第二页。即ScreenTwo

I want second page to show up in the array like this

1 个答案:

答案 0 :(得分:0)

如果要显示其他页面,则需要在所选控制器的awake方法中插入对becomeCurrentPage()的调用。

override func awake(withContext context: Any?) {
    super.awake(withContext: context)

    // Do your stuff with the context and determine if it is the controller to display

    if mustBeDisplayed {
        becomeCurrentPage()
    }
}