UIAlertController handle dismiss upon click outside (IPad)

Posted by Tomer Peled on Stack Overflow See other posts from Stack Overflow or by Tomer Peled
Published on 2014-08-23T21:54:40Z Indexed on 2014/08/24 4:20 UTC
Read the original article Hit count: 429

Previous to iOS8 we used the UIActionSheet for showing alert and now we need to use the UIAlertController.

When we used the UIActionSheet we could easily handle situations where the user clicked outside the pop up (which means he want to cancel the operation) by comparing the clickedButtonAtIndex to the cancelButtonIndex - if the user indeed pressed outside the popup we got the cancel button index in this function.

How can we handle these situations with the new UIAlertController? I tried to use the "completion" block but it doesn't have any context. Is there an easy way to handle this? (other than "saving" the actions states in some general variable).

© Stack Overflow or respective owner

Related posts about ios

Related posts about iPad