How to disable cancel button interaction?

In apple watch, the Upper left side controller interface has canceled the shortcut or title of the screen. In my case, as soon as the login is complete, you do not want to go to the back screen. Therefore, I want to disable user interaction for this cancel mark or screen area. Although the name does not exist, it takes user interaction and takes it into the background. Thanks in advance!

+6
source share
2 answers

We cannot disable the back / cancel button intraraction, but we can load the controller without the cancel button.

presentControllerWithName("NewInterfaceController", context: nil) 

presentControllerWithName a controller will appear with a cancel button. If we use, as shown below, we will not receive the cancel button.

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

reloadRootControllersWithNames , this will make our controller as the root controller so that we do not receive the cancel button. This is how I solved my problem. Hope this helps you too.

NOTE: here [] is the syntax. exp: ["NewInterfaceController"]

+11
source

You cannot disable user interaction for the back button.

But you can change the way you present your ideas a bit to accomplish what you want.

Start with the usual look. Check if you need to show the username to the user. If you do this, then imagine the type of login modally. At the end of the login, you close the modal view, and you return to the normal view, without the unnecessary return button.

+1
source

Source: https://habr.com/ru/post/988506/


All Articles