I know Auto Layout can be used to make the sizes and position consistent when the orientation changes. Is it possible to completely change the layout when the orientation changes?
For example, please look at the below wire-frame of a simple login screen in portrait mode.
Now if I rotate the device, I want to completely re-position the controls.
Can this kind of a thing be done by using Auto Layout? If not, how should I go about this?
Thank you.
In your case it can be achieved by two methods, instead of reframing every component you can group the controls like the following..
Parent View -> User Info View -> All User Info controls.. By doing this you will have to just reframe the User Info View not all the controls..
Then only Logo and Company name left to reframe.. Total 3 controls to reframe if you group your controls..
Create two views one for Portrait and other for Landscape mode, and just add and remove on rotations.. this is the fastest way as you won't have to readjust the frame by tedious code.
Hope above helps.
you cant set frames differently : -
-(void)setFramesForPotrait
{
// set frames here
}
-(void)setFramesForLandscaeMode
{
// set frames here
}
-(bool)shouldAutorotate.....
{
return Yes
}
-()willAutoRotate......
{
if(orientation = uiinterfaceOrientationPotrait)
{
[self setFramesForPotrait];
}
else
{
[self setFramesForLandscape];
}
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