UITapGestureRecognizer called immediately
问题 I am trying to add a UITapGestureRecognizer to a imageview as shown below let gest=UITapGestureRecognizer(target: self, action: Selector(imgPressed())); gest.delegate=self thalaImg.addGestureRecognizer(gest) And here is the imgPressed function : func imgPressed() { let alert=UIAlertController(title: "Img", message: "img pressed", preferredStyle: .Alert) let okButton=UIAlertAction(title: "Ok", style: .Default, handler: nil) alert.addAction(okButton) presentViewController(alert, animated: true,