Apple Watch 上的内置锻炼应用程序如何从主表格行导航到一组基于页面的控制器?

问题描述:

我试图模仿锻炼应用程序进行练习.我一直在思考如何从主屏幕中的这些表格行导航到基于页面且似乎是分层的 3/4 锻炼起始屏幕,左上角有一个后退按钮.它们肯定不是 Modal,因为它们不是从底部出现的.

I was trying to mimic the Workout app for practise. And I got stuck at figuring out how to do this navigation from these table rows in the main screen to the 3/4 Workout starting screens which are page-based and seem to be hierarchical, with a back button on top left. They are most certainly not Modal as they do not appear from the bottom.

- - ->

然而,我没有找到任何方法将一行连接到一组带有推送segue的基于页面的界面控制器.

However I did not find any way to connect a row to a set of page-based interface controllers with push segue.

这是我试过的:

1-presentController(withNames:, contexts:) 以MODALLY 形式呈现基于页面的布局.

1- presentController(withNames:, contexts:) which presents the page-based layout MODALLY.

override func table(_ table: WKInterfaceTable, didSelectRowAt rowIndex: Int) {
        let controllers = controllersForExercise(categories[rowIndex])
        presentController(withNames: controllers, contexts: nil)
    }

func controllersForExercise(_ exercise: Exercise) -> [String] {
        // Returns a bunch of Identifiers (from Storyboard) as [String]
    }

2- 在情节提要中,我通过 push segue 将表格行连接到这些基于页面的界面控制器中的第一个,然后使用 nextPage segue(关系)将该控制器依次连接到其他三个基于页面的界面控制器.这没有用.它只是与左上角的后退按钮相连,但仅显示第一个界面控制器,而不显示其他三个作为基于页面的控制器.我假设这是因为表格行选择使其成为分层导航,而这是基于页面的导航,并且根据 Apple 的说法,两者不能混合.

2- In the storyboard, I connected the table row to the first of these page-based interface controllers by a push segue, and then connected that controller to the other three page-based interface controllers sequentially using nextPage segue (relationship). This did not work. It just segues with the back button on top left but showed only the first interface controller, not the other three as page-based controllers. I am assuming it is happening because table row selection makes it a hierarchical navigation while this is a page-based navigation, and the two cannot be mixed according to Apple.

所以我对 Apple 自己管理它的方式感到困惑.有什么线索吗?

So I am baffled about how Apple manages it themselves. Any clues?

OBJC:

+ (void)reloadRootPageControllersWithNames:(NSArray<NSString *> *)names 
                              contexts:(NSArray *)contexts 
                           orientation:(WKPageOrientation)orientation 
                             pageIndex:(NSInteger)pageIndex;

快速:

class func reloadRootPageControllers(withNames names: [String], 
                        contexts: [Any]?, 
                     orientation: WKPageOrientation, 
                       pageIndex: Int)