Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.

Share this Page URL

Chapter 6. saving, editing, and sorting ... > The scroll view is the same size as ... - Pg. 245

saving, editing, and sorting data The scroll view is the same size as the screen Interface Builder created the UIScrollView, but there are a few finishing touches we must do manually to make this work the way we want. We need to tell the UIScrollView how big its content area is so it knows what it will need to scroll. We do that by setting its contentSize property. You'll need to add an outlet and property for the UIScrollView, then wire it up in Interface Builder so we can get to it. So how do we figure out how big the contentSize should be? When the UIScrollView is the same size as our screen, we don't have anything outside of the visible area that it needs to worry about. Since the scroll view is the same size as our UIView that it's sitting in, we can grab the size from there, like this: scrollView.contentSize = self.view.frame.size; Once you've added that line, you'll have a scroll view that takes up all of the available space, and it thinks its content view is the same Once you re size it, the