Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to hide navigation bar back button?

Tags:

I'm trying to to hide navigation bar back button on an Apple Watch. There are a lot of questions for similar to mine but they are for iPhone and if you are know a little about Apple Watch there are InterfaceController instead of ViewController.

So when I push a new InterfaceController using the code below:

[self pushControllerWithName:@"about" context:nil];

It shows a back button on the navigation bar above and it takes it back to the previous InterfaceController from which it is generated.

Anyone have any idea how to hide or remove navigation bar or this back button from Apple Watch?

like image 628
Chaudhry Talha Avatar asked Jan 19 '15 06:01

Chaudhry Talha


People also ask

How do I hide the back button on my navigation bar?

Touch “Settings” -> “Display” -> “Navigation bar” -> “Buttons” -> “Button layout”. Choose the pattern in “Hide navigation bar” -> When the app opens, the navigation bar will be automatically hidden and you can swipe up from the bottom corner of the screen to show it.

How do I hide the navigation bar in full screen?

The navigation bar is pinned by default. If you want to view files or use apps in full screen, double-tap the Show and hide button to hide the navigation bar.

How do I get rid of the back button on my Iphone?

Please navigate to Advanced Website Kiosk Settings–>Navigation–>Disable back button. Kindly enable this restriction to disallow the usage of the back button on the iOS device.


1 Answers

I had the same problem and solved it using :

NSMutableArray* controllerNames = [NSMutableArray new];
[controllerNames addObject:@"myInterfaceController"];
[WKInterfaceController reloadRootControllersWithNames:controllerNames contexts:myArrayOfData];

When the ICs are reloaded then they don't have navigation back buttons as they are the main IC.

Note

This method actually change your Initial Controller ( Main Interface Controller with arrow in storyboard.) of your watch app, that is the reason the Interface Controller does not have back button.

like image 112
AMAN77 Avatar answered Sep 26 '22 03:09

AMAN77