Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

iOS

Form that scrolls past the bottom fold of the iOS device?

I have a couple pages that have more content than will fit in a UIView. I do not understand how to use the UIScrollView in conjunction with these form elements in storyboard in order to create the long form and have it be scrollable. Suggestions?

1 Answer

Peter Pult
Peter Pult
8,095 Points

Please provide more information (screenshots, code, etc.).

In code you'd normally add your content to the scroll view and than set the frame of the scroll view and it's content size. Something like:

[self.scrollView addSubview:view1];
[self.scrollView addSubview:button1];
[self.scrollView addSubview:view2];
[self.scrollView setFrame: CGRectMake(0, 0, 320, 480)];
[self.scrollView setContentSize:CGSizeMake(320, view1.frame.size.height + button1.frame.size.height + view2.frame.size.height)];

Just be careful to set the frames of the sub views accordingly.

I don't have any code for it because I don't understand how to approach it.

I have a form that I want to make lets say it has the following fields.

name: UITextField city: UITextField phone: UITextField website: UITextField phone: UITextField summary: UITextarea CategorySelect: UIButton PhotoSelect: UIButton Tags: (unknown field not sure what I should use really). (maybe some other fields.)

On a standard iPhone 5 some these fields fall below the fold (ie bottom of the screen) of the portrait styled iphone view).

1) In storyboard I have dragged a scroll view over to the UIView so that it is contained within the UIView but I am unable to add fields below the fold of the iPhone representation in storyboard.

I have not tried going this programmatically as I was hoping to do it within Storyboard since that's how everything else I have regarding layout is done.

Peter Pult
Peter Pult
8,095 Points

Haven't done that myself, but maybe this will help you.

Awesomeness. I'll give this a try after I'm done fighting server configurations.