user784625
user784625

Reputation: 1938

UIScroll View which contains UIScrollView (Images)

I build a UIScrollView which is allowed to scroll right and left, in this main UIScrollView I added custom UIViews, each UIView contains an UIImageView with UIScrollView, and this UIScrollView can only pinch, the problem is that the main UIScrollView works fine, but the one in the custom UIView don't work.

I tried to disable the main scrollView and try scrolling in the scrollview of the UIView and it does not work.

should I make sure of enabling disabling something, what cause this, and if I'm using of multiple UIscrollViews or nested scrollViews what should I take care of?

Thanks,

Upvotes: 0

Views: 1985

Answers (2)

user784625
user784625

Reputation: 1938

    UIPinchGestureRecognizer *pinchRecognizer = [[UIPinchGestureRecognizer alloc] initWithTarget:self action:@selector(scale:)];
    pinchRecognizer.delegate = (id) self;
    [scrollView addGestureRecognizer:pinchRecognizer];

I solve the issue by adding gesture

Upvotes: 0

makboney
makboney

Reputation: 1824

Try to handle the touch events of Custom Subviews. In Your Custom Subview handle the events:

- (void) touchesBegan:(NSSet*)touches withEvent:(UIEvent*)event{}

- (void) touchesMoved:(NSSet*)touches withEvent:(UIEvent*)event{}

- (void) touchesEnded:(NSSet*)touches withEvent:(UIEvent*)event{}

Upvotes: 1

Related Questions