How do I work on a higher view in an interface builder?

OK, so I'm learning how to use UIScrollView in an interface builder. since scrollView itself has no content, I created another view, contentView, to hold my controls and scrollable content. in this view, I place controls, labels, etc., and then in my code, I set the scroll contentSize to the size of this content.

My question seems amazingly simple and so obvious that I must have missed something. when I created this XIB in IB, I got your standard blank iPhone interface window. I threw scrollView on top of it, it occupied the whole window. I took a look from above, it took up the whole scrollview. I have added some controls that so far I still see inside the contentView rectangle in IB.

My question is, how can I work on / add controls that lie outside the visible part of the contentView in IB? Lol it seems so simple, but I just don't get it. I can set the height of the content view or drag the rectangle to whatever I like (and this is actually the whole point of having scroll), but the fixed UI window from IB will not expand, so I can see the “off-screen” part of the View content to add more controls. This is similar to the fact that it is simply fixed at that size, because the size of one screen of the iPhone and it will not allow me to make it larger / higher.

what did I do wrong?

-a

+6
iphone interface-builder uiscrollview
source share
6 answers

You need to disable all simulated user interface elements (such as the status bar) as “undefined”, except for the size you select as “Free form” from the drop-down list, and then you can set the height using the “Ruler” tab to be what you like.

For example, here I selected the photo view controller and set the size in the right sidebar as “iPad Full Screen”, but I could also change this to “freeform” to set whatever height I wanted.

Choosing VC in Interface Builder

Custom size

+12
source share

First add the ViewController in whatever way you prefer. Then, in the interface builder, click the view controller icon (left). In the Connection Inspector, click the Show Size Inspector ruler icon. There will be a list of options for the simulated size, change to "Freeform" and increase the height to whatever size you want. Hope this helps.

+3
source share

unbeliever. you drag the content up so that some controls are off-screen and then add more controls / extensions to the part that you just made visible by moving the top layer on top. essentially, you physically scroll the contentView in IB by dragging it with the mouse. seems like a counter virus, but anyway.

+2
source share

You do not need to create a view to fit inside the scroll if you do not want it. In your case, it sounds like it doesn't make much sense.

As for the second part of your question, you can place elements directly in scrollview (this is afterall view), like subviews. If you want them to disconnect from the screen, just set their frame to be in the specific x, y coordinates that you want them to be. You will need to make sure that the scrollview contentSize property is large enough to fit all the content, this allows you to scroll horizontally / vertically.

+1
source share

Set the simulated size to any shape for the view controller with a sufficiently large size that you can add to your controls.

enter image description here

+1
source share

You probably want to make program elements off-screen instead of using xibs.

0
source share

All Articles