Search code examples
iossdcalertviewsdcalertcontroller

How to dismiss SDCAlertView with tap gesture?


To show alert I use SDCAlertView(clone of UIAlertView). I want to dismiss alert by tap on screen like UIActionSheet.


Solution

  • Unlike UIAlertView, SDCAlertView is added as a view to the view hierarchy. That means that you can simply add a tap gesture recognizer to SDCAlertView's superview, which calls [SDCAlertView dismissWithClickedButtonIndex:animated:].