views:

20

answers:

1

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?

A: 

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.

Michal