USE OF DESTRUCTIVE BUTTON ON UIACTIONSHEET IN IOS

Karen Green

Total Post:6

Points:42
Posted by  Karen Green
 999  View(s)
Ratings:
Rate this:

I am creating an application using UIActionSheet. When I implement action sheet I saw an destructive button on the action sheet. My action sheet also contains a 'Cancel' button and when I tap on 'Cancel' button it will dismiss the action sheet,

but I am not understanding what is the role of 'destructive' button here.

Can any one explain me.

  1. Tarun Kumar

    Post:214

    Points:1642
    Re: Use of destructive button on UIActionSheet in iOS

    UIActionSheet's destructive button is added to the action sheet automatically and assigned an appropriate index, which is available from the destructiveButtonIndex property.
    destructive button is displayed in red to indicate that it represents a destructive behavior.(if you do not want destructive button then Specify nil in the parameter of action sheet method).
    I always use destructive button as a delete button, so that its background color is in red.
    Use action sheet's clickedButtonAtIndex: method to set actions on any index button:
    Here is the method:

    - (void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex

      Modified On Nov-26-2015 11:32:54 PM

Answer

NEWSLETTER

Enter your email address here always to be updated. We promise not to spam!