Apple Watch 上的内置锻炼应用程序如何从 table 主行导航到一组基于页面的控制器?
How does the inbuilt Workout app on Apple Watch navigate from main table row to a set of page-based controllers?
我试图模仿 Workout 应用程序进行练习。我一直想弄清楚如何从主屏幕中的这些 table 行导航到 3/4 锻炼开始屏幕,这些屏幕是基于页面的并且似乎是分层的,左上角有一个后退按钮.它们肯定不是模态的,因为它们不是从底部出现的。
- - ->
但是我没有找到任何方法将行连接到一组带有推送转场的基于页面的界面控制器。
这是我试过的:
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- 在故事板中,我通过推送连接将 table 行连接到这些基于页面的界面控制器中的第一个,然后将该控制器依次连接到其他三个基于页面的界面控制器使用 nextPage segue(关系)。
这没有用。它只是与左上角的后退按钮相连,但只显示了第一个界面控制器,而没有显示其他三个作为基于页面的控制器。
我假设它正在发生,因为 table 行选择使其成为分层导航,而这是基于页面的导航,并且根据 Apple 不能将两者混合。
所以我对 Apple 如何自己管理它感到困惑。有什么线索吗?
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)
我试图模仿 Workout 应用程序进行练习。我一直想弄清楚如何从主屏幕中的这些 table 行导航到 3/4 锻炼开始屏幕,这些屏幕是基于页面的并且似乎是分层的,左上角有一个后退按钮.它们肯定不是模态的,因为它们不是从底部出现的。
但是我没有找到任何方法将行连接到一组带有推送转场的基于页面的界面控制器。
这是我试过的:
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- 在故事板中,我通过推送连接将 table 行连接到这些基于页面的界面控制器中的第一个,然后将该控制器依次连接到其他三个基于页面的界面控制器使用 nextPage segue(关系)。
所以我对 Apple 如何自己管理它感到困惑。有什么线索吗?
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)