I am trying to add a UITapGesture
to a UIButton so it will trigger a function when tapped. I am using Swift 3
and is getting some error:
Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[SwiftRunner.ViewController tapBlurButton]: unrecognized selector sent to instance 0x149e07610'
This is roughly what I have:
// Swift 3
import UIKit
class ViewController {
@IBOutlet weak var qsBlurButton: UIButton!
override func viewDidLoad() {
super.viewDidLoad()
let tapGesture = UITapGestureRecognizer(target: self, action: Selector(("tapBlurButton")))
qsBlurButton.addGestureRecognizer(tapGesture)
}
func tapBlurButton(sender: UITapGestureRecognizer) {
print("Please Help!")
}
}