I am developing an app with auto layout turned off and default setting to the Iphone 5. Now I have a UIView at the bottom of the screen, when I switch between the size options in IB the UIView correctly moves up to fix itself to the bottom of the screen. When however I test on my IPhone 4 or the simulator it doesn't move up, instead it gets cutoff.
How can I make it so that the UIView at the bottom of the app gets shunted upwards for the smaller IPhone 4?
See the following example
I basically want the white box to be shunted upwards to fill the gap underneath the grey box.
Update
In terms of the view hierarchy, there is a containing view and then the white section that you see is a simple UIView (white background) with a scroll view inside. The project is fairly new so the setup is very simple and there is no code to position any of the UIViews.
to get the Y coord, get the screen height, subtract any UI elements above the main view (like status bar) and subtract the height of the UIView you are placing. For example:
float y = [UIScreen mainScreen].bounds.size.height - [UIApplication sharedApplication].statusBarFrame.size.height - myView.frame.size.height;
[myView setFrame:CGRectMake(0, y, myView.frame.size.width, myView.frame.size.height)];
Here's a really typical full example...2013...this works nicely in a UITableViewController with a nav bar at top, and you are not using autolayout.
Position a UIView relative to the bottom of the parent view?
Hope it helps someone.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With