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?
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.
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.
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.
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.
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
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With