Smig
Smig

Reputation: 693

How to set the back command of a Form without adding a back command to the title of an IOS device?

I needed to customize the back functionality of an app because part of its navigation isn't based on different forms, but it's based on changing content in the same form. It's natural to expect, while navigating a hierarchy of products to go back in that hierarchy by pressing the device's back button, if it has one, instead of leaving the current form.

To do this, I've used the Form's setBackCommand() method, which works as expected except that by doing so, it also adds a back command to the title bar of the IOS device in the simulator. I don't want one because I already have an in-app back functionality, and the code in that method is only meant for those that press the hard button on a device that has one. I considered using the CN1 created command instead of the in-app one, even though I'd rather not, but I also can't set an UIID, so it's just an ugly rectangle with the command's name on it. I also tried to apply that method only if UIBuilder's isBackCommandEnabled() was true, thinking that it would target the devices with back buttons, but it doesn't seem to make a difference (and by the wording on the docs, it seems it sets it, instead of just testing it, which I find a little misleading: "Seamlessly inserts a back command to all the forms").

So, how do I set the behavior of the back command for the devices that have it built-in, without adding one to the others?

Upvotes: 0

Views: 588

Answers (1)

Shai Almog
Shai Almog

Reputation: 52770

This isn't ideal but before invoking the setBackCommand call you can check Display's command behavior and see if its COMMAND_BEHAVIOR_BUTTON_BAR_TITLE_BACK.

Upvotes: 1

Related Questions