FidelCashflo
FidelCashflo

Reputation: 533

Adding items in UIScrollView

I need to add a couple more items into the scroll view but as you can see in the pic, I do not have enough space to do so. When I try to stretch the scroll view out of the view, it wont let me add objects to it.

Screen Shot

So my question is, how can I keep on visually adding objects to the scroll view?

Thanks

Upvotes: 1

Views: 1072

Answers (3)

FidelCashflo
FidelCashflo

Reputation: 533

I figured out a way to make the view screen bigger and by expanding that, I was able to make the scrollView bigger and use that as a subview of the view.

Thanks for the help everyone!

Upvotes: 0

Ha cong Thuan
Ha cong Thuan

Reputation: 683

You can add 1 ScroolView and chose Size : Freeform and add item you need on scroolview and add scroll view to viewcontroller [self.view addsupView: scroolview];  here

i think help you :p

Upvotes: 1

Jumhyn
Jumhyn

Reputation: 6777

Unfortunately, there is no easy way to do this in Interface Builder. The best you can do is to increase the height of the UIScrollView, drag and drop your UI elements, then resize and reposition the view to be centered on the screen. Once you do that, don't forget to set the contentSize property of your scroll view, or else you wont be able to access anything outside the main screen.

To do that, you can either use scrollView.contentSize = CGSizeMake(width, height);, or you can use the User Defined Runtime Attributes in Interface Builder. This can be found in the Identity Inspector, which has the info about the class, Storyboard ID, et cetera. Add a runtime attribute, set the Key Path to contentSize, the Type to Size, and the value to the desired content size (e.g. {width, height}).

Upvotes: 2

Related Questions