Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Guidelines for destructive button on UIActionSheet

What are the guidelines for setting a button as destructive button on a action sheet. My action sheet contains two buttons "Cancel" and "Delete", tapping on "Cancel" dismisses the action sheet whereas tapping on "Delete" will delete the selected item. Which one should I choose as destructive button?

like image 218
Abhinav Avatar asked Nov 24 '10 17:11

Abhinav


People also ask

What is a destructive button?

The destructive button is for emphasizing actions that can be destructive or have negative consequences if taken. It replaces the primary CTA button in these destructive situations and should be used sparingly. A destructive button and a primary CTA should never appear on the same screen.

How do you display an action sheet?

To display an alert or action sheet, create a UIAlertController object, configure it, and call its presentViewController:animated:completion: method, as shown in the following code.

What is Actionsheet?

An action sheet consists of a list of options a user can select from to complete an action. Actions can be clustered if there is not enough space on the screen. Warning. This control has a number of limitations, which were addressed with the introduction of the menu button.

Does Android have action sheets?

The same design". But Action Sheets are ABSOLUTELY different in Android. If you spend some time reading some UX books about Android UX, you'll learn that the ActionSheets should be displayed on the TopRight corner, or in a center modal, depending on the content to show.


2 Answers

From the Class Reference:

cancelButtonTitle The title of the cancel button. This button is added to the action sheet automatically and assigned an appropriate index, which is available from the cancelButtonIndex property. This button is displayed in black to indicate that it represents the cancel action. Specify nil if you do not want a cancel button or are presenting the action sheet on an iPad.

destructiveButtonTitle The title of the destructive button. This button is added to the action sheet automatically and assigned an appropriate index, which is available from the destructiveButtonIndex property. This button is displayed in red to indicate that it represents a destructive behavior. Specify nil if you do not want a destructive button.

I would use a Destructive button for the delete, since that will be in red. Then a cancel button below it in black.

Use this method to give each button whatever action you need:

- (void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex
like image 132
Mark Leonard Avatar answered Oct 24 '22 06:10

Mark Leonard


From dictionary.com

destructive: tending to destroy; causing destruction or much damage

So that would be the Delete button you should choose as the destructive button. The destructive button is displayed in red to indicate that pressing the button will lead to something that is potential "dangerous", as deleting a contact or marking all items a read.

like image 23
Robert Höglund Avatar answered Oct 24 '22 06:10

Robert Höglund