在 WatchOS 上移动到不同的屏幕

Move to different screens at WatchOS

我正在尝试使用 WatchOS 导航到不同的屏幕,但是当我在按钮中选择此操作时:

[self presentControllerWithName:@"Screen2" context:contextDic];

Screen2 正确打开,但在此屏幕内我有一个执行此操作的按钮:

[self pushControllerWithName:@"Screen1" context:context];

而且这个按钮不起作用,我无法转到 Screen1。我怎样才能按下这个 Screen2 的按钮并关闭它并返回到 Screen1?我在这个屏幕上使用了 presentControllerWithName 但我不想在顶部使用上一个按钮。

您应该使用方法 popController 返回到以前的界面控制器。

After pushing an interface controller onto the screen, use this method to remove it and display the previous interface controller again. The system animates the transition back to the previous interface controller asynchronously.

注意:此方法仅适用于 watchOS 2.0。

WKInterfaceController class reference 中查看更多信息。