I have all my buttons / labels / texts embedded in a uiscrollview. Everything works fine. However, how do I see / edit beneath the 480px mark in IB? It cuts off the uiscrollview at the bottom. I am using storyboarding in xcode 4.2 ios5.
Just in case you haven't yet found the answer and to save an answer. The solution is simple, but hard to find an answer on the web. Try this:
Select the Scroll View object
Select the Size Inspector (option-cmd-4)
Under View -> Y, enter a negative number (acts as scroll up)
Make sure View -> Height is large enough for the contents of your scroll view
Add, position and configure subview
(Optional) Set the View -> Y back to 0 for building
Before:
After setting the Y value:
Related
I have some issues when i launch my swift application on ipad simulator. I have a home view witch displays 5 images. In my storyboard i have set for all of those constraints for height, width and also spacing. The problem is that when my app is running from ipad , the photo on the middle is situated over the other ones and the spacing is not as i expected.
What i want is a way i can make the same space value between images for each screen size and that the images will resize themselves in order to respect the initial view. Any piece of advice is more than welcome !^.^
Remove width and height constraints for your image views and add equal width and equal height constraints to them. Check out "Auto Layout Tutorial" section "Fixing the width" to see how to set equal width between views. I recommend you to read it whole :)
Nikita is right.
I can add: often apps evolve, so you will add another image.. far better to pass to a CollectionView where every CollectionViewCell owns an image.
In this way:
1) you can decide layout very precisely (with constraints in InterfaceBuilder, or form code using NSCollectionViewFlowLayout delegate methods..)
2) You can manage rotation easily
3) You can scale for iPhone..
I've created a tableview, in the xib editor of the xcode. I've positioned the table view in the middle of the screen, it starts somewhere in the middle (100 pt. form the top) and should end a little bit lower (it's total height is 200 pt.). But when I run it on the simulator it fills the height of the TableView until the bottom of the screen.
Sorry for the nooby question. I'm just starting with iOS after years of java.
Screensot
Go to the Size inspector tab. and remove the bottom resize from xib just like this screenshot
Just go to file inspector tab and disable (un-checked) the Use Autolayout
I have a UITabelView as my interface. My height is bigger than 460 pixels. I cannot edit any of my Table View Cells (or anything) below the bottom of the simulated APP at 460px I do not want to "programmatically add things in the interface." How do I "SCROLL" in interface builder??
I am using Xcode 4.2 and using STORYBOARDS as well!!
Thank you so much!!!!
Set your view's y axis (-ve). Like if you have table view 600px which mean you have 160px non visible by default. For editing it make your view or table view to y axis = -160. You will get your view visible. But don't forget make it 0 again and height to 460 for running your app well.
I think this is what you was looking for. Let me know in case of else thing.
You may find my question stupid but I'm new to Objective C dev and I'm still learning basic things. I made a form in my app with a text field in the bottom of the view. But when this field get the focus, keyboard shows up and it hides the field so no way to see what I'm typing. I've found solutions online about it especially with the use of UIScrollView to fix the issue.
The issue I've now is with the Scroll View itself. I moved my text field to replace it with a UIScrollView of about same size, then I drag drop my field back but this time as a subview of the ScrollView. But when running the app the text field is going up, that is its position in interface builder is different to what I can see when running the app.
I need your help about the size I need to apply to the Scroll View and its content to make it useful in this case. Should it have the exact size as the text field ? should it have the same size as the whole view ?
Thx for helping,
Stephane
A UIScrollView has two "sizes". The one is that of its own frame (i.e. how much space does it take up). And how large is the contentSize of the scrollview (i.e. how far left/right/up/down can we scroll)
The general Idea would be this:
your UIScrollView has the size of the available screen real estate when the keyboard is hidden (say 320 x 460 or so), it takes up as much space as its content (assuming your content also needs 320 x 460), scrolling isn't enabled.
once the keyboard shows, the scrollView will have to scale down (say 320 x 244), the content obviously doesn't scale down, that way you're now able to scroll.
I'd probably use something like
moveTextViewForKeyboard:(NSNotification*)aNotification up: (BOOL) up
to trigger the frameSize change of the scrollView and enable scrolling.
OK, so I am learning to use UIScrollView in interface builder. since the scrollView itself does not have any content, I created another view, the contentView, to hold my controls and scrollable content. into this view I place controls, labels, etc and then in my code i set the contentSize of the scrollView to the size of this contentView.
My question seems stunningly simple and so obvious that I must have missed something somewhere. when I created this XIB in IB I got your standard empty iPhone interface window. I dropped a scrollView on top of it, it took up the whole window. I dropped a view on top of that, it took up the whole scrollview. I added some controls, which so far I can still see inside the contentView rectangle in IB.
My question is how do I work on/add controls which lie outside of 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 indeed this is the whole point of having a scrollview) but the fixed UI window from IB won't expand so i can see the "offscreen" part of the contentView to add more controls. It's like it's just fixed at that size because that's the size of one iPhone screen and it won't let me make it any bigger/taller.
what did I do wrong?
-a
You need to turn off all simulated user interface elements (like the status bar) to be "undefined" except for size, which you select to be "Freeform" from the drop-down, and then you can set the view height using the Ruler tab to be whatever you like.
For example, here I've selected a photo view controller, and set the size in the right side bar to be "iPad Full Screen" - but I could also change that to "freeform" to set any height I wished.
First add a ViewController by any which way you prefer. Then in interface builder, click on the view controller Icon (on left). In the connections inspector click on the ruler icon "Show the size inspector". There will be option list for simulated size, change to "Freeform" and increase the height to any size you want. Hope this helps.
neeever mind. you drag the content view up so that some controls are offscreen and then add more controls/expand to the part you just made visible by moving the top stuff off the top. in effect, you physically scroll the contentView in IB by dragging it with the mouse. seems a smidge counterintuitive, but whatever.
Set simulated size to freeform for the the view controller to a large enough size that you can add in your controls
You don't have to create a view to place inside the scrollview if you don't want. In your case, it sounds like it doesn't make much sense.
As for the second part of your question, you can place items directly on the scrollview (it is a view afterall), as subviews. If you want them to be off screen, then just set their frame up to be at those particular x, y coordinates you want it to be at. You will have to ensure your scrollview's contentSize property is large enough though to house your entire content, this is what allows scrolling horizontally/vertically.
You probably want to do the offscreen elements programmaticly instead of using xibs.