translationInView equal to 0 when fast panning using UIScreenEdgePanGestureRecognizer

匿名 (未验证) 提交于 2019-12-03 01:45:01

问题:

I created a test project showing the problem.

When I do a fast pan from the left or right edge, during the state UIGestureRecognizerState.Began, the translationInView is equal to (0.0, 0.0). This happens when you are in landscape and do the gesture in the lower half of the device (iphone 6 in my case) or when you are in portraitand do the gesture in about the 1rst third part of the screen (from the bottom).

Is it... normal? I guess it's probably know but couldn't find anything.

回答1:

I don't think there's anything wrong with your code. The value returned by translationInView(_:) is relative to the first point where the gesture began, which makes sense during the .Began because that is immediately after that first point is established.

Also, just want to make sure you understand that you are using UIScreenEdgePanGestureRecognizer and not some other UIPanGestureRecognizer. The normal behavior of UIScreenEdgePanGestureRecognizer is to only be active near the screen edges, which explains the active areas you are describing. Since you mention it, just want to make sure there's no confusion (please person me if that's not the case).



标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!