如何隐藏 Apple Watch 状态栏的后退按钮?
How to hide the back button from the status bar on the Apple Watch?
我想在状态栏中隐藏 Apple Watch 应用程序的后退按钮。
我使用可编程的 segue 进行导航。但我想 hide/disable 后退按钮。可能吗?
如果您查看 WKInterfaceController
的文档,您会发现没有 API 来完成您要查找的内容:https://developer.apple.com/library/prerelease/ios/documentation/WatchKit/Reference/WKInterfaceController_class/
您最多只能更改 title/button 的文本或调整色调。
您可以使用方法 presentControllerWithName
以模态方式呈现界面控制器。然后,在调用的界面控制器中,只需使用 setTitle
.
方法设置标题即可
这就是你的做法:
WKInterfaceController.reloadRootControllersWithNames(
["myInterfaceController"], contexts: []
)
其中 myInterfaceController
是目标接口控制器的标识符。
感谢 Harvant 的指点。
在 WatchOS 6 中,Storyboard 上有一个选项可以将界面控制器设置为 Full Screen
。
Select Storyboard
中的 Interface Controller
您想隐藏后退按钮,在右侧面板中您会看到 Full Screen
的检查:
我想在状态栏中隐藏 Apple Watch 应用程序的后退按钮。
我使用可编程的 segue 进行导航。但我想 hide/disable 后退按钮。可能吗?
如果您查看 WKInterfaceController
的文档,您会发现没有 API 来完成您要查找的内容:https://developer.apple.com/library/prerelease/ios/documentation/WatchKit/Reference/WKInterfaceController_class/
您最多只能更改 title/button 的文本或调整色调。
您可以使用方法 presentControllerWithName
以模态方式呈现界面控制器。然后,在调用的界面控制器中,只需使用 setTitle
.
这就是你的做法:
WKInterfaceController.reloadRootControllersWithNames(
["myInterfaceController"], contexts: []
)
其中 myInterfaceController
是目标接口控制器的标识符。
感谢 Harvant 的指点。
在 WatchOS 6 中,Storyboard 上有一个选项可以将界面控制器设置为 Full Screen
。
Select Storyboard
中的 Interface Controller
您想隐藏后退按钮,在右侧面板中您会看到 Full Screen
的检查: