i am using ScrollviewDelegate Protocol in viewcontroller.but i am using Custom UIView(UIImageview)in that custom view touch began, touch ended is working ,but touchMoved is not called.how can i achieve this one?
+2
A:
If scrolling in UIScrollView is enabled then touchMoved
events are not propagated to the scroll view contents. How to workaround that depends on what you want to achieve. In my application I needed just to drag an object inside UIScrollView
and I did the following in contentsView touch handlers for that:
- In touchesBegan: event I checked if I tapped object to be dragged. If YES - then disabled scrolling in UIScrollView
- Then as scrolling was disabled my contents view started to receive
touchesMoved
event and I could "drag" my object there. - In
touchesEnded:
I reenabled scrolling.
If you want something more complex you can subclass UIScrollView and try to override its touch handlers (see also hitTest:withEvent:
method)
Vladimir
2010-03-31 14:41:40