Protocol: UIAlertViewDelegate

Overview

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.Sent to the delegate when the user clicks a button on an alert view.Sent to the delegate after an alert view is dismissed from the screen.Sent to the delegate before an alert view is dismissed.Sent to the delegate before an alert view is canceled.Sent to the delegate to determine whether the first non-cancel button ion the alert should be enabled.Sent to the delegate after an alert view is presented to the user. Sent to the delegate before a model view is presented to the user.

Instance Method Summary (collapse)

Instance Method Details

- (Object) alertView(alertView, clickedButtonAtIndex:buttonIndex)

Sent to the delegate when the user clicks a button on an alert view. The receiver is automatically dismissed after this method is invoked.

Parameters:

  • alertView (UIAlertView)

    The alert view containing the button.

  • buttonIndex (Integer)

    The index of the button that was clicked. The button indices start at 0.

Returns:

- (Object) alertView(alertView, didDismissWithButtonIndex:buttonIndex)

Sent to the delegate after an alert view is dismissed from the screen. This method is invoked after the animation ends and the view is hidden.

Parameters:

  • alertView (UIAlertView)

    The alert view that was dismissed.

  • buttonIndex (Integer)

    The index of the button that was clicked. The button indices start at 0. If this is the cancel button index, the alert view is canceling. If -1, the cancel button index is not set.

Returns:

- (Object) alertView(alertView, willDismissWithButtonIndex:buttonIndex)

Sent to the delegate before an alert view is dismissed. This method is invoked before the animation begins and the view is hidden.

Parameters:

  • alertView (UIAlertView)

    The alert view that is about to be dismissed.

  • buttonIndex (Integer)

    The index of the button that was clicked. The button indices start at 0. If this is the cancel button index, the alert view is canceling. If -1, the cancel button index is not set.

Returns:

- (Object) alertViewCancel(alertView)

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

Parameters:

  • alertView (UIAlertView)

    The alert view that will be canceled.

Returns:

- (Boolean) alertViewShouldEnableFirstOtherButton(alertView)

Sent to the delegate to determine whether the first non-cancel button ion the alert should be enabled.

Parameters:

  • alertView (UIAlertView)

    The alert view that is being configured.

Returns:

  • (Boolean)

    YES if the button should be enabled, no if the button should be disabled.

- (Object) didPresentAlertView(alertView)

Sent to the delegate after an alert view is presented to the user.

Parameters:

  • alertView (UIAlertView)

    The alert view that was displayed.

Returns:

- (Object) willPresentAlertView(alertView)

Sent to the delegate before a model view is presented to the user.

Parameters:

  • alertView (UIAlertView)

    The alert view that is about to be displayed.

Returns: