本文介绍了Apple Watch上的内置Workout应用程序如何从主表行导航到一组基于页面的控制器?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试模仿Workout应用的实践.而且我被困在如何从主屏幕中的这些表行导航到3/4 Workout起始屏幕的导航中,这些屏幕基于页面,并且似乎是分层的,左上角有一个后退按钮.它们肯定不是模态的,因为它们不是从底部出现的.

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.

--->

但是我没有找到任何通过推键将行连接到一组基于页面的界面控制器的方法.

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-在情节提要中,我通过推式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;

SWIFT:

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

这篇关于Apple Watch上的内置Workout应用程序如何从主表行导航到一组基于页面的控制器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-23 18:21