开发者

Prevent UIScrollView from cancelling touchesMoved: of subview?

I have a UIScrollView. On top of it I allow the user to add a DraggableView (a subclass of UIImageView) by applying a long press gesture to the UIScrollView. The DraggableView overrides touchesMoved: and allows the user to drag the view around. This works until either one of two cases happens:

  • The UIScrollView detects another long press while the user moves (after all his finger has been on the screen for a while)
  • The UIScrollView starts to scroll.

What is the best way to prevent the long press detection and the开发者_StackOverflow scrolling of the scroll view while the user is dragging my view around? Is there a built in mechanism or do I have to keep track of a status somewhere and react accordingly?

Replies in ObjC and Monotouch are both welcome.


Figured it out meanwhile. UIScrollView has a property do enable or disable scrolling. I just set that and enable scrolling again once my long press has been handled.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜