GestureRecognizer not responding to tap GestureRecognizer not responding to tap ios ios

GestureRecognizer not responding to tap


I was using UITapGestureRecognizer that I placed on a UILabel using Storyboard.

To get this to work I also had to place a checkmark in the block labeled: "User Interaction Enabled" in the UILabel Attributes Inspector in the Storyboard.

enter image description here


I discovered the answer after carefully combing through my code.

One of the parent views was created without supplying a frame:

While it's a noobish enough error to warrant deletion of this questions, odds are someone else will also have the same issue in the future...


Try this

override func viewDidAppear(animated: Bool) {    super.viewDidAppear(animated)    self.view.userInteractionEnabled = true    var tapGesture = UITapGestureRecognizer(target: self, action: Selector("handleTap:"))    self.view.addGestureRecognizer(tapGesture)}func handleTap(sender : UIView) {    println("Tap Gesture recognized")}