I have a 4 UIViews inside a UIScrollView. Assume 1 of it is a chart like in iphone stocks aplication. When I move the finger across the chart I need to draw a vertical line.I can use the touchesMoved for that.
But Also I need to move horizontally scroll my views. Problem is when I move my finger across the chart, UIScrollView scrolls horizontally.
How can i avoid this and identify those 2 as different events?
UIScrollView forwards touches to subviews only after a small delay. If a touch is moved until this delay fires, UIScrollView interprets the touch as move of contentOffset. To touch your subview try to hold it for a second, then start moving.
You can set delaysContentTouches on scrollView to NO, then touches are forwarded immediately.
I found the solution here.
On the touchesBegan method I need to make the UIScrollView's scrolling disabled. Then inside the touchesEnded I need to make the scrolling enabled again.