Saturday, 15 January 2011

ios - How can I fix a UIView to the bottom of the screen? -



ios - How can I fix a UIView to the bottom of the screen? -

i developing app auto layout turned off , default setting iphone 5. have uiview @ bottom of screen, when switch between size options in ib uiview correctly moves prepare bottom of screen. when test on iphone 4 or simulator doesn't move up, instead gets cutoff.

how can create uiview @ bottom of app gets shunted upwards smaller iphone 4?

see next example

i want white box shunted upwards fill gap underneath gray box.

update

in terms of view hierarchy, there containing view , white section see simple uiview (white background) scroll view inside. project new setup simple , there no code position of uiviews.

to y coord, screen height, subtract ui elements above main view (like status bar) , subtract height of uiview placing. 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 typical total example...2013...this works nicely in uitableviewcontroller nav bar @ top, , not using autolayout.

position uiview relative bottom of parent view?

hope helps someone.

ios cocoa-touch

No comments:

Post a Comment