Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Problem with UIScrollView inside another UIView

I have this UIScrollView inside another UIView, not occuping the entire area (all this is initialized via nib file). I added some content to the scroll view, but whenever I scroll it, the UIScrollView content area moves outside the ScrollView frame, over the UIView area not designated for displaying it.

Shouldn't it remain inside its frame even when I scroll it?

like image 741
Lorenzo Avatar asked Mar 04 '11 18:03

Lorenzo


1 Answers

It may be that the clipsToBounds property of your UIScrollView is set to NO. Check the setting in IB, or you can set it in code like so:

scrollView.clipsToBounds = YES;

Failing that, double check that your UIScrollView has exactly the bounds you think it does. Is there any autoresizing flag stuff going on that might be changing the scroll view's bounds?

like image 167
occulus Avatar answered Sep 30 '22 21:09

occulus