如何隐藏Apple Watch上状态栏的后退按钮?

时间:2015-05-12 07:45:22

标签: swift segue watchkit

我想隐藏状态栏中Apple Watch应用程序的后退按钮。

我使用可编程segue进行导航。但我想隐藏/禁用后退按钮。有可能吗?

4 个答案:

答案 0 :(得分:5)

您就是这样做的:

WKInterfaceController.reloadRootControllersWithNames(
     ["myInterfaceController"], contexts: []
)

其中myInterfaceController是目标接口控制器的标识符。

感谢Harvant的指针。

答案 1 :(得分:1)

如果您查看了WKInterfaceController的文档,那么您将看到没有API可以完成您正在寻找的内容:https://developer.apple.com/library/prerelease/ios/documentation/WatchKit/Reference/WKInterfaceController_class/

您可以做的最好的事情是更改标题/按钮的文字或调整色调颜色。

答案 2 :(得分:0)

您可以使用方法presentControllerWithName以模态方式呈现接口控制器。然后,在调用的接口控制器中,只需使用方法setTitle设置标题。

答案 3 :(得分:0)

在WatchOS 6中,情节提要中有一个选项可以将接口控制器设置为Full Screen

Interface Controller中选择要隐藏后退按钮的Storyboard,在右侧面板中,您会看到Full Screen的勾选:

enter image description here