The UIAlertViewDelegate
protocol defines two methods, alertView:clickedButtonAtIndex:
and alertView:didDismissWithButtonIndex:
, which seem to me to be identical in usefulness.
Why is there a clickedButtonAtIndex
and a didDismissButtonWithIndex
when they both do the same thing? I realize there is also a willDismissButtonWithIndex
that happens before the alert view is dismissed, but is there any reason to use clickedButtonAtIndex
instead of didDismissButtonWithIndex
?
I found a more useful difference between the two:
When showing a UIAlertView
, and the device goes to sleep, alertView:didDismissWithButtonAtIndex:
gets called, even though the alert view is not actually dismissed. It is shown again once the device wakes up. alertView:clickedButtonAtIndex:
is only called when the user clicks one of the buttons.
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