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

问题描述 投票:1回答:1

我试图模仿Workout应用程序进行练习。而且我一直想知道如何从主屏幕中的这些表行导航到3/4 Workout起始屏幕,这些屏幕是基于页面的,看起来是分层的,左上方有一个后退按钮。它们肯定不是莫代尔,因为它们不会从底部出现。

Interface controller with table - - - > enter image description here

但是我没有找到任何方法使用push segue将行连接到一组基于页面的接口控制器。

这是我试过的:

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-在故事板中,我通过push segue将表行连接到这些基于页面的界面控制器中的第一个,然后使用nextPage segue(关系)将该控制器连接到其他三个基于页面的界面控制器。 enter image description here这没用。它只是左上角的后退按钮,但只显示第一个接口控制器,而不显示其他三个作为基于页面的控制器。我假设它正在发生,因为表行选择使它成为分层导航,而这是一个基于页面的导航,并且这两个不能根据Apple混合。

所以我对Apple自己如何管理它感到困惑。有线索吗?

swift watchkit apple-watch
1个回答
1
投票

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)
© www.soinside.com 2019 - 2024. All rights reserved.