0

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)

3 Answers 3

2

Yes you can add a view to UIScrollView without deleting buttons, labels, etc..

To add a scroll view to existing view:

  1. Draw and drop the UIScroll View to the existing View
  2. Select all controls in the View like Buttons, Label etc.; except UIScroll View
  3. Drag all the selected component into UIScroll View

Let me know if you have any doubt.

Sign up to request clarification or add additional context in comments.

Comments

1

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. :)

Comments

0

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.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.