IOS: Why does touchhesBegan have some delay in a specific area in a UIView

I am creating a custom keyboard and I have a very strange situation.

I noticed that when I catch the Began event in the lower left corner (about 20 pixels) of the UIView (inputView), I will have a little delay here. Any action I do in touchBegan will be slower than in another area.

override func touchesBegan(touches: Set<UITouch>, withEvent event: UIEvent?) { self.keypop.hidden = false } override func touchesEnded(touches: Set<UITouch>, withEvent event: UIEvent?) { { self.keypop.hidden = true } 

And this problem affects the performance of my application. In this example, I will not see the keyboard appear when I touch the left side on the left, because self.keypop.hidden delayed when it appears.

I don’t know why, or is it a bug from iOS 9? I am stuck with this problem for a week.

+5
source share
2 answers

The answer here seems to fix the same issue on our keyboard:

UISystemGateGestureRecognizer and pending taps near the bottom of the screen

With the following code:

 override func viewDidAppear(animated: Bool) { let window = view.window! let gr0 = window.gestureRecognizers![0] as UIGestureRecognizer let gr1 = window.gestureRecognizers![1] as UIGestureRecognizer gr0.delaysTouchesBegan = false gr1.delaysTouchesBegan = false } 
+5
source

In my situation, I used touchBegan in CollectionView, and it delayed touches when I clicked. He worked with me just adding this code

In Swift

 self.collectionView.delaysContentTouches = false /*delaysContentTouches applies to all UIScrollView instances.*/ 
+3
source

Source: https://habr.com/ru/post/1236014/


All Articles