Search code examples
ioshig

xcode/ios: HIG: Is it better practice to have cancel and done or just back (with automatic save)


It is best practice to automatically save changes when you click back button as in Settings app on iPhone or have separate Cancel (on left side of nav bar) and Done on (right side of nave bar) buttons, or is it okay either way?

Here is settings approach: enter image description here

Here is cancel/done approach:

enter image description here

I have a lot of these and don't want to do them all the wrong way only to have to change them later.

Thank you.


Solution

  • There's a pretty significant difference between your two examples. In the first, you are editing existing data and as such it makes sense that everything will just save in real time. In the second example, you may or may not create an entity. Here, cancel is really important. If I click the new contact button by mistake I do not want an empty contact to be created if I back out.

    So the questions you need to ask yourself above all else as far as which button is appropriate;

    Am I creating something or editing something that already exists?

    If you are editing something that isn't new you probably want an arrow and to save immediately. If you're making a new thing, you need to have an obvious way to cancel doing so.

    If a user backs out during entity creation, should that entity be created or discarded?

    Unless you want whatever is on the page to be mandatory, you should give people a way to cancel that is very clear and also be as clear as possible that going back will destroy any entered data.