Protocol

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.

Overview

The UIActionSheetDelegate protocol defines the methods a delegate of a UIActionSheet object should implement. The delegate implements the button actions and any other custom behavior. Some of the methods defined in this protocol are optional.

If you add your own buttons or customize the behavior of an action sheet, implement a delegate conforming to this protocol to handle the corresponding delegate messages. Use the delegate property of the action sheet object to specify one of your application objects as the delegate.

If you add your own buttons to an action sheet, the delegate must implement the actionSheet(_:clickedButtonAt:) message to respond when those buttons are clicked; otherwise, your custom buttons do nothing. The action sheet is automatically dismissed after the actionSheet(_:clickedButtonAt:) delegate method is invoked.

Optionally, you can implement the actionSheetCancel(_:) method to take the appropriate action when the system cancels your action sheet. If the delegate does not implement this method, the default behavior is to simulate the user clicking the cancel button and closing the view.

You can also optionally augment the behavior of presenting and dismissing action sheets using the methods in Customizing Behavior.

Topics

Responding to Actions

func actionSheet(UIActionSheet, clickedButtonAt: Int)

Sent to the delegate when the user clicks a button on an action sheet.

Deprecated

Customizing Behavior

func willPresent(UIActionSheet)

Sent to the delegate before an action sheet is presented to the user.

Deprecated
func didPresent(UIActionSheet)

Sent to the delegate after an action sheet is presented to the user.

Deprecated
func actionSheet(UIActionSheet, willDismissWithButtonIndex: Int)

Sent to the delegate before an action sheet is dismissed.

Deprecated
func actionSheet(UIActionSheet, didDismissWithButtonIndex: Int)

Sent to the delegate after an action sheet is dismissed from the screen.

Deprecated

Canceling

func actionSheetCancel(UIActionSheet)

Sent to the delegate before an action sheet is canceled.

Deprecated

Relationships

Inherits From

See Also

Deprecated Protocols

protocol UIAccelerometerDelegate

The UIAccelerometerDelegate protocol defines a single method for receiving acceleration-related data from the system. Implementation of this method is optional, but expected.

protocol UIAlertViewDelegate

For apps that run in versions of iOS prior to iOS 8, the UIAlertViewDelegate protocol defines the methods a delegate of a UIAlertView object should implement. The delegate implements the button actions and any other custom behavior. Some of the methods defined in this protocol are optional.

protocol UIPopoverControllerDelegate

The UIPopoverControllerDelegate protocol defines the methods you can implement for the delegate of a UIPopoverController object. Popover controllers notify their delegate whenever user interactions would cause the dismissal of the popover and, in some cases, give the user a chance to prevent that dismissal.

protocol UISearchDisplayDelegate

Important: UISearchDisplayDelegate is deprecated in iOS 8. (Note that UISearchDisplayController is also deprecated.) To manage the presentation of a search bar and display search results in iOS 8 and later, instead use UISearchControllerDelegate.