views:

93

answers:

1

Hey stackoverflow,

So I have an app that has a login screen with an image and text bars. When I rotate the device, the components rotate, but they are not centered anymore. They just pivot in place. I need them to reposition themselves to the center of the landscape view as well. Can anyone point me to or have an example of how to handle a rotation like this? Any help would be appreciated. Thanks!

+2  A: 

You need to set the autoresizingMask on things that get rotated. If you built your interface with Interface Builder, you can do that on the layout tab of the property inspector. You can even preview the effect by clicking the arrow on the right side of the title bar of your view.

Brian
That kind of works. I can kind of control where it will be positioned but not completely. I can center it, but I want it to move like 1/4 of the way down the page. It can't be half because then the buttons are covered up by the keyboard...
gabaum10
autoresizingMask is a simple way to keep things in the same relative position. If you need something more complicated than that, you'll have to subclass UIView and override `layoutSubviews`.
Brian
Gotya. I ended up playing with it in IB a little bit to make it work decently well. Thanks for the help.
gabaum10