Passing a swip event to another control

I have a UITextView on top of a UIView. They are in the PageScrollView. User can scroll all outside of UITextView and go to next page (view). I would like the user to scroll through the UITextView and click over the next view.

The UITextView scrolls vertically when there is a lot of text that the user can swipe in and see the rest. Scroll view scroll horizontally. I need a UITextView to give it horizontal scrolling in a UIView. How can i do this?

0


a source to share


1 answer


If you subclass UITextView

and override each touch events:

  • touchesBegan: withEvent:
  • touchesMoved: withEvent:
  • touchesEnded: withEvent:
  • touchesCancelled: withEvent:

with this:



- (void) touchesXXX:(NSSet *)touches withEvent:(UIEvent *)event {
    [super touchesXXX:touches withEvent:event];
    [[self nextResponder] touchesXXX:touches withEvent:event];
}

      

This will allow all touches to be handled with both the help UITextView

and its parent view. Since yours UITextView

scrolls exclusively vertically and yours UIScrollView

scrolls exclusively horizontally, this will work fine.

+1


a source







All Articles