Search code examples
iphoneiosuiviewcontrolleruiscrollviewuitouch

Touch events (touchesMoved) not working on UIViews inside UIScrollView


I have a UIView inside a UIScrollView, and the UIViewControllers for those views are not receiving the touch events. If I take the views out of the scroll view then it works.

UserInteraction is default ON of all views but it's still not working!

This must be possible and I'd be really grateful if someone could point me in the right direction!

Many Thanks,


Solution

  • add the following code to implementation file then touches moved

     @interface UIScrollView(Custom)
        @end
        @implementation UIScrollView(Custom)
    
       -(void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event
    {
        [super touchesMoved:touches withEvent:event];
    }
        @end