开发者

UIPanGestureRecognizer on a view inside of a scroll view works only sporadically when scroll view is zoomed in far

I have a UIPanGestureRecognizer on a view inside of a UIScrollView. Its function is to move its parent view around when panned. This works perfectly well at 1x and 2x zoom resolutions in the scroll view, but zooming in farther causes them to fail quite often - yet not alway开发者_Go百科s.

There is also a long press & double tap recognizer on the same view, which both work fine when zoomed in. Overriding the hitTest method on the scroll view shows that the UIGesture view does in fact receive touches when zoomed in (which is expected, given that these other recognizers work.)

I've tried several combinations of cancelContentTouches & other attributes on the scroll view with no success.

Does anyone have any suggestions?


One workaround I've tried: make your PanGesture'd views siblings of the scroll view, and update their position / scale manually via UIScrollViewDelegate didScroll. You will have to take the scroll view's transform into consideration whenever inspecting the PanGesture views, though (such as getting position information).

Obviously this is not ideal - if anyone else still has a better solution, I'd be happy to hear it!

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜