UIAlertView: Where the cancel button should be?
Asked Answered
M

5

27

The alert views in iOS system:

  • Install App OTA: the cancel button is on the LEFT.
  • Delete an App: the cancel button is on the RIGHT.

Where the cancel button should be?

Mudpack answered 5/7, 2011 at 12:39 Comment(0)
T
52

From Human Interface Guideline:

In a two-button alert that proposes a potentially risky action, the button that cancels the action should be on the right (and light-colored).

In a two-button alert that proposes a benign action that people are likely to want, the button that cancels the action should be on the left (and dark-colored).

Thresher answered 5/7, 2011 at 12:48 Comment(2)
I see, but is that really friendly to user? Sometime it is on the left, and sometime it is on the right. When an alert view is shown, user must take attention on that which is the cancel button. How do you think about it?Nona
I think Apple is suggesting the more prominent button should be in right. When the action is risky or destructive then cancel is at right. And when the opposite the other button is at right. May be right handed people are tend to select right button, though I'm not sure though what is the psychology behind this.Thresher
O
5

As per Apple Place buttons where people expect them. In general, buttons people are most likely to tap should be on the right. Cancel buttons should always be on the left. https://developer.apple.com/design/human-interface-guidelines/ios/views/alerts/

Osithe answered 26/5, 2017 at 5:58 Comment(0)
S
3

If you set the text for the cancel button in the initializer, iOS will take care of this for you.

As the Human Interface Guidelines say:

In a two-button alert that proposes a potentially risky action, the button that cancels the action should be on the right (and light-colored).

Although, in practice, you may be labeling your buttons with something other than the generic label. (I have Yes/No) alerts in many circumstances. As your example from Apple shows, this part of the HIG won't be a deal breaker for your app.

Sphingosine answered 5/7, 2011 at 12:55 Comment(0)
S
0

The definition in was slightly updated (no dark-light colored references):

  1. When the most likely button performs a nondestructive action, it should be on the right in a two-button alert. The button that cancels this action should be on the left.
  2. When the most likely button performs a destructive action, it should be on the left in a two-button alert. The button that cancels this action should be on the right.
Stairway answered 15/6, 2015 at 9:41 Comment(0)
R
-3
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Title" message:@"Message" delegate:nil cancelButtonTitle:@"Cancel" otherButtonTitles:@"Continue"];

The cancel button will be on the left side of the screen in this case which is the default case.

Rubinrubina answered 5/7, 2011 at 12:45 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.