Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

MarcVanH

macrumors newbie
Original poster
Sep 12, 2008
15
0
I am trying to create a "settings" page - the single page kind that is really long and scrollable.

I know I can do this with a Table view (like in UICatalog), but since I just need a single page of controls, I was hoping to do it without all the complexities of a table view.

Can anyone tell me how to create a long, scrollable view, that I can throw like 20 buttons and sliders on, in interface Builder?
 

tsornin

macrumors newbie
Jul 23, 2002
26
0
You could use UIScrollView ... in IB just start with a view object and change its parent in the inspector. You can then set the height of the view to larger than the actual iphone window, and add whatever controls you need in the bigger view window.

I'm messing around with something similar, although one problem I haven't sorted out yet is how to deal with several scrolling UITextViews on top of a scrollview. When I test it in the simulator, it scrolls the first text view, rather than the entire scrollview.
 

MarcVanH

macrumors newbie
Original poster
Sep 12, 2008
15
0
I played with UIScrollView for hours with no luck. Gave up assuming it was just for images, etc.

Can you walk me through it a bit more specifically?
 

tsornin

macrumors newbie
Jul 23, 2002
26
0
I played with UIScrollView for hours with no luck. Gave up assuming it was just for images, etc.

Can you walk me through it a bit more specifically?

In interface builder, create a new->view. Click on the view object, and open the inspector window. Look under view identity and change the class identity to "UIScrollView". Then go to the size tab (in the inspector) and change the height from 480 to 600 (or whatever).

Then you can click on your scroll view object to bring up the view window, and drag whatever controls you want from the IB library into the view.

Of course you'll still have to set up the appropriate IBOutlet variables and IBAction methods for all your controls (and possibly some delegate methods, depending on what controls you add) in the view controller.

Only caveat is there doesn't seem to be any way to scroll the scroll view in interface builder itself, so I guess your scrollview is pretty much limited to the height of your screen. If you wanted a longer view you'd probably have to do it all programmatically, rather than using interface builder...
 

MarcVanH

macrumors newbie
Original poster
Sep 12, 2008
15
0
I swear I tried that a few times, but I'll give it another go. Thanks!
 

MarcVanH

macrumors newbie
Original poster
Sep 12, 2008
15
0
Still no luck. I can make the view, change its class, make it's height real tall, and add controls no problem. But when I display it, no scrolling.

How are you displaying the view? With some kind of controller?
 

PhoneyDeveloper

macrumors 68040
Sep 2, 2008
3,114
93
There's no need to first create a UIView and then change its class to UIScrollView. Just use the UIScrollView from the catalog.

I've attached an example project. The one line that's required sets the content size for the scrollview. The rest is done in IB.
 

Attachments

  • ScrollViewTest.zip
    12.7 KB · Views: 2,719
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.