I added an UITapGestureRecogniser
to my tableViewCell which recognizes if the user double tapped a cell. If I double tap the cell, the function didSelectRowAtIndexPath
gets automatically called. I just want that the func of the gesturerecogniser gets called if the user do a double tap on a cell and not both. Does someone have an idea to solve this?
In viewDidLoad function :
let aSelector : Selector = “start:”
let tapGesture = UITapGestureRecognizer(target: self, action: aSelector)
tapGesture.numberOfTapsRequired = 1
view.addGestureRecognizer(tapGesture)
let bSelector : Selector = “stop:”
let doubleTapGesture = UITapGestureRecognizer(target: self, action: bSelector)
doubleTapGesture.numberOfTapsRequired = 2
view.addGestureRecognizer(doubleTapGesture)
tapGesture.requireGestureRecognizerToFail(doubleTapGesture)
The action aSelector will be called on single tap and bSelector on double tap.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.