简体   繁体   English

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

[英]How does the inbuilt Workout app on Apple Watch navigate from main table row to a set of page-based controllers?

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.我一直在想如何从主屏幕中的这些表格行到基于页面且似乎是分层的 3/4 锻炼起始屏幕进行导航,左上角有一个后退按钮。 They are most certainly not Modal as they do not appear from the bottom.它们肯定不是 Modal,因为它们不是从底部出现的。

带表的接口控制器 - - -> - - -> 在此处输入图片说明

However I did not find any way to connect a row to a set of page-based interface controllers with push segue.但是,我没有找到任何方法将一行连接到一组带有 push segue 的基于页面的界面控制器。

This is what I tried:这是我尝试过的:

1- presentController(withNames:, contexts:) which presents the page-based layout MODALLY. 1-presentController(withNames:, contexts:) 以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- 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). 2- 在情节提要中,我通过 push segue 将表格行连接到这些基于页面的界面控制器中的第一个,然后使用 nextPage segue(关系)将该控制器依次连接到其他三个基于页面的界面控制器。 在此处输入图片说明 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.所以我对 Apple 自己管理它的方式感到困惑。 Any clues?有什么线索吗?

OBJC:对象:

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

SWIFT:迅速:

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM