Adding items to scrollview in storyboard (size inspector appears to be locked)?

The only way I've been able to edit my content in a UIScrollView (and this dates back to way before the Storyboard, but I'm pretty sure it still applies) is to change the offset of the x or y of your content frame.

Up vote 2 down vote favorite 1 share g+ share fb share tw.

I've added a scrollview with a content size that is larger than the screen size in my view controller using storyboard. Of course the purpose of the scrollview is to have content larger than the view that contains it. I would like to add buttons and label to the bottom of the scrollview graphically in storyboard, but I can't view that part of the scrollview.

How do I get there. I tried adjusting in the size inspector which worked for me when I first added the view a few weeks ago, but it don't let me change anything. Iphone xcode uiscrollview storyboard link|improve this question asked Jan 20 at 21:16T.J.9701211 100% accept rate.

The only way I've been able to edit my content in a UIScrollView (and this dates back to way before the Storyboard, but I'm pretty sure it still applies) is to change the offset of the x or y of your content frame. Another option, depending on whether your content view is "static" (built in the . Xib) or not, is to actually pull it outside of the scroll view, and set it as the content view programmatically in viewDidLoad or something.

Hope this helps, I can follow up with code examples if it makes sense and you need 'em. EDIT (2/10/2012): Here's an example of how to hook up the larger view to your scroll view. In this example, the scroll view (scrollView) is set to the view controller's view property.

In the . Xib I've also added a UIView named largerView. The two are not hooked up in any way in the .

Xib file, they just both appear there. Given... @property (nonatomic, retain) IBOutlet UIView *largeView; @property (nonatomic, retain) IBOutlet UIScrollView *scrollView; In viewDidLoad: we just... // add the largeView to the main scrollView scrollView addSubview:largeView; scrollView setContentSize:largeView.frame. Size; This is probably the simplest possible example though.

Good luck!

I went back and looked at this again. I discovered the scroll view that has content larger than the view in storyboard was the top level view of the view controller. When configured like this you can't adjust the x and y offset in the size inspector.

However, if a uiview is the top level and the scroll view is placed in that, then the content offset (x and y under "view" in the size inspector) can be adjusted exposing different areas of the scrollview in storyboard so they can be configured. Problem solved! – T.J. Feb 9 at 4:03 Code examples would be great!

:) – whoisgregg Feb 10 at 18:59 Added a code example for hooking a view to a scroll view programmatically. – livingtech Feb 10 at 19:19 @livingtech: Please check the added answer and correct me if I am wrong. – mrunal Feb 12 at 13:01.

It's great that you solved that. If I had that problem I would create a view that has the same frame size as content size of the scroll view. Add all the controls I need (buttons, labels, textFields etc.) on this view at the positions I need.

After that just added the view on scroll, make an IBOutlet of the scroll and set it's content size programmatically somewhere in my code, before using that scroll (setting it in viewDidLoad will be fine). That's another solution of this problem.

I like that too. I'll give it a go next time I'm in that situation. – T.J. Feb 9 at 13:58 This is what I suggested also.

– livingtech Feb 10 at 19:20.

Here you are creating two views (UIView largeView and UIScrollView scrollView). So its kind of wasting of memory for the same objects. First add one more UIView in your nib with your height and width.

Add your controls wherever you want. (let say largeView only) Then use embed property with ScrollView. (let say myScrollView only) Now add this myScrollView in your original view wherever you want with your custom height and width.

In code base just set myScrollView contentSize as per the largeView size. This would be easier for the code reusability and expandability purpose. If in future you need to add more objects.

I'm not 100% sure I'm following you here, but I think this is still the same number of objects as what I suggested. I'm pretty sure you always need a UIView to be the content view of your UIScrollView. – livingtech Feb 13 at 20:23.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions