1

In our Apple Watch swift application we have two controllers(Login and dashboard controller). After login user will land to dashboard page and after clicking on back button it is again landing to login page. So, my requirement is that after clicking on back button on dashboard it should stay on same dashboard page.

So, How can I prevent back action and assign custom action once back button clicked in apple WatchKit application?

Dávid Pásztor
  • 51,403
  • 9
  • 85
  • 116
Sandip patil
  • 123
  • 2
  • 14
  • It seems like what you are looking for is not adding a custom action, but hiding the back button, so have a look at [How to hide the back button from the status bar on the Apple Watch](https://stackoverflow.com/questions/30184738/how-to-hide-the-back-button-from-the-status-bar-on-the-apple-watch) – Dávid Pásztor Sep 13 '18 at 08:41
  • @Dávid Pásztor : none of the solution from that question is working. – Sandip patil Sep 13 '18 at 09:35

1 Answers1

1

I think what you might be looking for is to call reloadRootPageControllers on WKInterfaceController:

https://developer.apple.com/documentation/watchkit/wkinterfacecontroller/2868441-reloadrootpagecontrollers

after successful login, and re-initialise your app's UI with the dashboard screen. This makes it impossible to go back to the login screen, and there will be no back button as the dashboard becomes the new root level app screen.

Hope this helps.

crafterm
  • 1,831
  • 19
  • 17