Question:
I am creating an iOS keyboard extension withUIInputViewController
, and using UIButton
for each key. I have two issues:- Sometimes buttons don’t detect touches.
- Touches at the edges of the screen are recognized with a delay.
I assume first one happens when I type too fast, or when touch area is too big (bigger than the button). I tried using different methods of detecting touch (
button target
, touchesBegan
, touchesEnded
, UITapGestureRecognizer
) and all have the same issue.I assume second happens because of the iOS edge false touch rejection. I tried changing
preferredScreenEdgesDeferringSystemGestures
but it had no effect.Please help.
Answer:
- Turns out I was playing a quick animation on the UIButton press, so I had to set
.allowUserInteraction
in the animation options. - I used
UILongPressGestureRecognizer
withminimumPressDuration = 0
which, for some reason, is always instant even at the edges.
If you have better answer, please add a comment about this, thank you!
Source: Stackoverflow.com
Leave a Review