UITapGestureRecognizer與UIPickerView不起作用。爲什麼?用於UIPIckerView的UITapGestureRecognizer
class someVC: UIViewController, UITapGestureRecognizerDelegate
override func viewDidLoad() {
let tap = UITapGestureRecognizer(target: self, action: "dismissKeyboard")
self.pickerView.addGestureRecognizer(tap)
tap.delegate = self
}
func dismissKeyboard() {
textField.resignFirstResponder()
}
謝謝解決的問題。我通過覆蓋gestureRecognizer解決了這個問題 – 2014-10-20 12:03:01