I want to hide my alert when any one click on view. Logout alert should be hide when click on black shadow area
please anyone help me.
I want to hide my alert when any one click on view. Logout alert should be hide when click on black shadow area
please anyone help me.
First of all you have to enable the interaction for the superview of the alert.
myAlert.view.superview.isUserInteractionEnabled = true
then you have to add a click gesture to superview which inturn will dismiss your view.
myAlert.view.superview.addGestureRecognizer(UITapGestureRecognizer(target: self, action: #selector(self.removeAlert)))