iOS Developer Library

Developer

UIKit Framework Reference UIActionSheetDelegate Protocol Reference

Options
Deployment Target:

On This Page
Language:

UIActionSheetDelegate

Important: UIActionSheetDelegate is deprecated in iOS 8. (Note that UIActionSheet is also deprecated.) To create and manage action sheets in iOS 8 and later, use UIAlertController. More...

Inheritance


Not Applicable

Import Statement


import UIKit @import UIKit;

Availability


Available in iOS 2.0 and later.
  • Sent to the delegate when the user clicks a button on an action sheet.

    Declaration

    Swift

    optional func actionSheet(_ actionSheet: UIActionSheet, clickedButtonAtIndex buttonIndex: Int)

    Objective-C

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

    Parameters

    actionSheet

    The action sheet containing the button.

    buttonIndex

    The position of the clicked button. The button indices start at 0.

    Discussion

    The receiver is automatically dismissed after this method is invoked.

    Import Statement

    import UIKit

    Availability

    Available in iOS 2.0 and later.

  • Sent to the delegate before an action sheet is canceled.

    Declaration

    Swift

    optional func actionSheetCancel(_ actionSheet: UIActionSheet)

    Objective-C

    - (void)actionSheetCancel:(UIActionSheet *)actionSheet

    Parameters

    actionSheet

    The action sheet that will be canceled.

    Discussion

    If the action sheet’s delegate does not implement this method, clicking the cancel button is simulated and the action sheet is dismissed. Implement this method if you need to perform some actions before an action sheet is canceled. An action sheet can be canceled at any time by the system—for example, when the user taps the Home button. The actionSheet:willDismissWithButtonIndex: and actionSheet:didDismissWithButtonIndex: methods are invoked after this method.

    Import Statement

    import UIKit

    Availability

    Available in iOS 2.0 and later.