iOS storyboard container view's autosizing mask - iphone

On storyboard, I dragged a container view into a view. I am not using auto layouts. I want to size it so that this view gets expanded and shrink depending on whether it's a 3.5 inch or a 4 inch screen (it should tag to the bottom of the screen). However the autoresizing mask doesn't seem have an effect when I run it in the 3.5 inch or the 4 inch simulator -- it says the same size. What could I do to correct it?

First off, make sure you're really not using Autolayout: open your storyboard, click on the File Inspector (which is the first panel to the right with the file icon), and make sure 'Use Autolayout is unchecked'.
Next select your Container View, go to the Size Inspector (which is the one with the ruler icon) and from the "Arrange" menu first select "Fill container vertically" and then "Fill container horizontally".
For me, this achieved the effect you wanted. I print out my Container View's frame in viewDidLoad and it changes depending on whether I'm on a 3.5" or 4" iPhone.

Related

Layout differencies in Interface Builder and real device screen

I' m developing an application for both Retina 3.5 and Retina 4 screens (iPhone family). And I encountered with the next problem. I create a view in .xib file and set size to Retina 3.5 full screen.At the very bottom of the screen I placed a view with UILabel. You can see the view on the screen:
As you can see the view is at the very bottom. But when I run the application either on device or the simulator view with label on some reason doesn't fit the screen:
So the question - what can be the problem? How can I fix this? Why IB view sizes is not correct?
You've set your NIB to not have a status bar, but your app does have one. This means your NIB is sized at 480 pts high (on a 3.5" screen), when it should in fact be 460 (due to the status bar). This pushes your view down by the corresponding height (20 pts, which you can see at your cut-off label at the bottom).
There are a number of fixes for this. You could just tell your NIB it has a status bar, but a better option would be to set your view to resize dynamically according to its bounds. Exactly how you do this will depend on whether you're using auto-layout or not, but you'll want to check 'autoresize subviews' and make sure your view elements stay locked where you want them to.

Having trouble with AutoSizing between 3.5" and 4" size screens

I am having a bit of trouble with the Autosizing of a UIScrollView within my nib file. It resizes fine in the Inspector view but when it comes on the device the one on the 3.5" version takes the height of the 4" version.
As you can see with the images below it resizes correctly in the interface builder view but on the device the view frame is too long for the 3.5" device.
I can change the frame of the view in the code using absolute values but i'd rather try and get it working by it automatically resizing.
It could be problem with UIWindow. Go to UIWindow properties and check that you have enabled Full screen at Launch
Your project should be for iOS 6 or higher, where you can use autolayout. That will do the resizing automatically like this. If you don't then you have to do it from code.
Last case: If your project is iOS 6 or higher and don't have autolayout, then on the nib file you're editing click on file's owner, on the Utilities section on the right click on the file inspector button and under the column Interface Builder Document there's a checkbox for "Use Autolayout" that should be checked.

MKMapView maximized, but I do not want it

I got an issue and I don't know why I have it and how to fix it! Maybe it is only a simple problem. Here are two screens:
There is something missing! Where is the Button? And why is the Map at full screen? It seems a bit strange can anyone help?
This is undoubtedly a function the screen going from a 4" screen when previewing your screen in Interface Builder to a 3.5" inch simulator/device screen.
If using autolayout (open up the storyboard, click on the first tab, the "File Inspector" and see if "Use Autolayout" is checked or not). Check your constraints. The map view should not have a height constraint (or if IB won't let you get rid of it, just drop its priority down to the lowest possible value...though if it adds the height constraint back in, it means that your other constraints are not fully qualified, such as neglecting the button's bottom constraint) but should have either a bottom constraint to the bottom of the screen or, better, to the button. Also make sure that the button's top constraint goes to the map view and that it has a bottom constraint that goes to the super view. Interface Builder makes this process far more complicated than it needs to be in its effort to add what it determines as missing constraints, IMHO, but it can work. It took me 2-3 minutes of fussing with all of the vertical constraints to make sure that they were both unambiguous as well as satisfiable at both screen heights.
If not using autolayout, check your autosizing masks (located on the "Size inspector" tab). You want flexible height and fixed bottom.
In IB you can toggle the appearance of your view from 4.0" to 3.5" by pressing the button. Just adjust your autolayout constraints or non-autolayout autosizing masks and then toggle back and forth between 3.5" screen and 4.0" screen to confirm whether everything is configured properly.

iOS : How to make TableView not to fill the height?

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

UIViewController Nib Layout changes at runtime

Notice the Nib on the left displays a layout with 2 UILabels, 1 UITextView and 2 buttons. The Y coordinate of the buttons changes at runtime. What is causing this and how do I fix it?
Update #1 - Problem goes away when I shift to a iPhone Retina 4-Inch display.
Update #2 SOLVED - Problem goes away when by unchecking 'Autolayout' in the xib properties.
It looks like you're using iOS 6 and a storyboard with the 4-inch "tall" iPhone screen form factor simulated. Assuming you are using Auto Layout, you probably have a constraint added to one or both of the buttons that pins them to the bottom of their superview. When you then run your app on the 3.5" screen iPhone simulator, the buttons appear to "move up" as their superview has gotten shorter than on your storyboard.
Find the button with the icon pictured below while editing your storyboard, and click it to toggle the simulated screen size between the 3.5-inch and 4-inch form factors. You should see your buttons re-layout based on their constraints.
To set your buttons' spacing relative to the top instead of bottom of their superview, select both buttons and from the menu bar choose the Editor menu > Pin > Top Space to Superview. (Or use the Pin button pictured below directly from the storyboard.)
There's a good introductory tutorial to Auto Layout here, if you haven't learned about it yet.