I want to create a large view to use with UIScrollView. Can I just create a large view (several pages long view) somehow and then add it to the storyboarda and embed in scroll view? Is there a convinient way to do it? Cos doing it just in storyboard is really frustrating.
Asked
Active
Viewed 553 times
1 Answers
1
Yes, you can create entire apps without using Interface Builder (what you refer to as storyboard). Use the following code to create the UIView:
UIView *theView = [[UIView alloc] initWithFrame: CGRectMake(x, y, width, height)];
viewOutlet = theView;
then add to an empty scrollView (made in Interface Builder) like so:
[theScrollView addSubview: theView];
[scroll setContentSize: theView.frame.size];
Also, if you want to make the scrollView without Interface Builder, use a similar code to the above:
UIScrollView *scrollview = [[UIScrollView alloc] initWithFrame: CGRectMake(x, y, width, height);
however, it is easier to create just the empty scrollView in Interface Builder because you can easily adjust settings (delays content touches, show horizontal/vertical scrollers, etc).

Greg
- 1,296
- 2
- 11
- 26
-
I mean a convenient way of creating a large view in interface builder. But just dragging it out in storyboard doesn't allow me to change it's size. It allows, if I embed it in scroll view, but I can't see the whole view in it and dragging out buttons to such view is very frustrating. – Ilya Lapan Apr 03 '12 at 12:09
-
you can go to the second tab from the right in IB and you can set a size manually (instead of having to drag the knobs on the side). – Greg Apr 03 '12 at 23:09