NickHowes
NickHowes

Reputation: 143

How to scroll a UIScrollView containing a UIView?

UIView * blueView = [[UIView alloc] initWithFrame:CGRectMake(10, 10, 100, 100)];
blueView.backgroundColor = [UIColor blueColor];
[scrollView addSubview:blueView];
scrollView.contentSize = CGSizeMake(1500, 2000);

I can drag-scroll in most of scrollView just fine, but dragging when the touch starts in blueView doesn't work.

How can touches that start within the UIView (blueView in this case) scroll the UIScrollView?

blueView is not first responder, blueView's next responder is scrollView, etc.

Seems pretty basic, but I'm stuck for a while now. What am I missing? thx.

Upvotes: 2

Views: 2303

Answers (1)

Mark Adams
Mark Adams

Reputation: 30846

Try setting blueView.userInteractionEnabled = NO.

Upvotes: 1

Related Questions