我正在进行键盘扩展,因此我想要在双击时切换时激活大写锁定,并让它在单击时定期移动。我的代码:
var selector: Selector = "lockCapsLock"
var singleTapSelector: Selector = "shift"
let doubleTapRecognizer = UITapGestureRecognizer(target: self, action: selector)
let singleTapRecognizer = UITapGestureRecognizer(target: self, action: singleTapSelector)
singleTapRecognizer.numberOfTapsRequired = 1
doubleTapRecognizer.numberOfTapsRequired = 2
v.addGestureRecognizer(doubleTapRecognizer)
v.addGestureRecognizer(singleTapRecognizer)
singleTapRecognizer.requireGestureRecognizerToFail(doubleTapRecognizer)
我遇到的问题是,当我点击它以使双击失败时需要太长时间,因此按下移位会有延迟。如果我太快按下shift然后按另一个键,它将小写,但随后下一个键将被正确移位。双击可正常工作。
如何减少单次敲击的延迟?