I have a scrollview which has to display a view larger than the available display area.
I want to easily design the user interface without moving the embedded view up and down every time I have to do some changes.
The problem is everything outside the visible area is invisible in IB.
Is there any switch or trick to make everything visible in IB?
UPDATE
I have posted another solution here which I think is simpler and better, and works in storyboards.
ORIGINAL
Create your scroll view in the nib with the appropriate superview, position, and size.
Next, create a completely separate, top-level
UIViewinstance by dragging aUIViewout of the palette and dropping it into the work area outside of any existing views. In the Attributes inspector, set the Size popup to “None” and make sure the Status Bar, Top Bar, and Bottom Bar are all set to None. Here’s an example:This new top-level view will be your content view. Give your view controller two outlets:
scrollViewandcontentView:In the nib, wire up the
scrollViewoutlet to the scroll view and wire up thecontentViewoutlet to the content view.Build your content view hierarchy inside the content view. Set its size as large as you need – it can be larger than 320×480 (as long as you have set all of its bars to None).
In your view controller’s
viewDidLoad, addcontentViewas a subview ofscrollViewand setscrollView.contentSizeto the size ofcontentView: