Question

I am just interesting from the point of view of "user experience" is good to disable back button and make to appear another button when some condition becomes true?

Example I have 3 views A, B, C. At the beginning a condition = false. I go A -> B. I change something in B and the condition becomes true. In this case I would like to disable possibility to return to the view A and enable possibility to go to the view C.

So my question is how I could do it? Hide back button and on this place make appear button, that enables to go to the view C? Or just disable back button and enable button with which I go to C?

Was it helpful?

Solution

This isn't a good use for a navigation controller. It's never a good idea to take control away from the user like this. Allow them to cancel their choice in some way. It's also not the correct metaphor for a navigation controller.

One way to do this without navigation controllers is to show some previously hidden control when a choice is made. Look in the Settings app, for example Date and Time, which shows more UI when a choice is made.

OTHER TIPS

As @nevanking said, I too believe that it isn't a good experience for the user, but what if you need it anyhow.

If you're using a UIButton with a title like "Back" or in case of your condition "Go to c" then you've to maintain its tag for specific conditions, so in common IBAction you can check for the specific condition and do either pop or push. You can do the same even if you're using image for "Back" and "Go to c" option.

#define BACK_BUTTON_TAG 1
#define PUSH_BUTTON_TAG 2

Do set tag base on your condition, btn.tag = BACK_BUTTON_TAG; or btn.tag = PUSH_BUTTON_TAG;

-(IBAction) doWhatIChoose {
    if(btn.tag == BACK_BUTTON_TAG) {
        //pop to A
    }else{
        //push to C
    }
}

Note that, you've to maintain stack of pushed viewcontrolles, from C you have to give user to option of popToRoot (i.e. A) or go back (i.e. B) and have to maintain the buttons state.

No. The user expects buttons to work, and BACK is like a safety net -- it has to be there.

I generally don't like disabled buttons, but if you use them, disabled buttons only make ense when you are going forward, e.g., placing an order, or proceeding through a series.

Note there are some cases where a "back" button could be acceptable in iOS, but never in the top-left. This would only be if you had a custom UI, e.g., a series of dots, and earlier modes would no longer make sense to access.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top