Reputation: 1709
I have built a small iOS 6 app that uses a single view. However, I would like to add some more functionality and therefore need more space. I figured that the best way to do this is to add a UIScrollView.
How can I add such a UIScrollView to my View? Do I have to delete all my buttons, labels, etc. in my View, then add a UIScrollView and then put all those buttons, labels, etc. in that UIScrollView? I think that this would work but is there an easier way to do this? (Maybe without deleting all the content in my view)
Upvotes: 0
Views: 221
Reputation: 1140
Add all views on scroll view like:
[scrollview addSubView:button];
And finally add this scrollview to main view:
[self.view addSubView:scrollview];
I think this will be helpfull. :)
Upvotes: 1
Reputation: 6218
Yes you can add a view to UIScrollView without deleting buttons, labels, etc..
To add a scroll view to existing view:
Let me know if you have any doubt.
Upvotes: 2
Reputation: 3210
programmatically you have to
[scrollview addSubView:button];
instead of [self.view addSubView:button];
In storyboard or xib you can drag and drop the button onto the scrollview.
Hope this helps a little bit.
Upvotes: 0