Manish Gumbal
Manish Gumbal

Reputation: 293

How to hide the back button from the status bar on the Apple Watch?

I want to hide the back button from my Apple Watch app from the status bar.

I used the programmable segue to navigate. But I want to to hide/disable the back button. Is it possible?

Upvotes: 6

Views: 5687

Answers (5)

Sahidul Islam
Sahidul Islam

Reputation: 139

On watchOS 5 an above

Replace pushController with below code

WKInterfaceController.reloadRootPageControllers(withNames: ["myInterfaceController"], contexts: nil, orientation: .horizontal, pageIndex: 0)

Upvotes: 0

aramusss
aramusss

Reputation: 2401

In WatchOS 6, there's an option on the Storyboard to set the Interface Controller to Full Screen.

Select the Interface Controller in Storyboard you want to hide the back button from, and in the right panel you'll see a check for Full Screen:

enter image description here

Upvotes: 1

infinite-loop
infinite-loop

Reputation: 902

This is how you do it:

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

Where myInterfaceController is the identifier of the destination Interface Controller.

Thanks to Harvant for the pointer.

Upvotes: 12

John
John

Reputation: 8538

You can present an interface controller modally using the method presentControllerWithName. Then, in the interface controller called, just set the title with the method setTitle.

Upvotes: 0

bgilham
bgilham

Reputation: 5939

If you check the docs for WKInterfaceController, you'll see there's no API to accomplish what you're looking for: https://developer.apple.com/library/prerelease/ios/documentation/WatchKit/Reference/WKInterfaceController_class/

The best you can do is change the text of the title/button or adjust the tint color.

Upvotes: 1

Related Questions