Positioning objects in views during re-orientation in iPad
Posted
by Arni
on Stack Overflow
See other posts from Stack Overflow
or by Arni
Published on 2010-05-07T22:10:22Z
Indexed on
2010/05/21
12:10 UTC
Read the original article
Hit count: 208
ipad
|orientation
iPad Gurus: Apple wants us to support all orientations. I take that to mean that a particular layout should either rotate so that all objects are positioned relatively the same OR, if that doesn't look good, then they ought to be repositioned, OR two views ought to be designed and built.
If I rely on the built-in rotation mechanism, the objects either get resized or they straddle the edge of the page in one orientation or the other, or they disappear from view altogether. I can't seem to find the right settings to get the objects to align clearly so they are seen in each orientation.
Repositioning leads to a lot of if statements in the View Controller. So I don't think Apple had that in mind.
I tried replacing views and even view controllers in "willRotateToInterfaceOrientation" method, but that either causes crashes or the portrait views end up in landscape unexpectedly and vv. Moreover, two view controllers means double the coding for the same view.
There must be proper way to handle orientation changes, but I have searched the internet and documentation and sample code in vain for something that works. How is this done properly?
Thanks!
© Stack Overflow or respective owner