I am using iPad 9.3 simulator. In app settings, I have Portrait, Landscape Left, Landscape Right.
I have one simple View with three blocks in Portrait layout.
- Block1
- Block2
Block3
In my view controller, I have
-(BOOL)shouldAutorotate { return NO; } - (UIInterfaceOrientationMask)supportedInterfaceOrientations { return UIInterfaceOrientationMaskPortrait; }
Now
- I press device Home button which takes app to background
- I rotate the simulator to landscape right.
I re-run application by doing
cmd-R
Now simulator opens up in landscape orientation.
- Status bar is also landscape.
- Width of view is smaller now. There is blank space on LHS.
- But with view rotated right with Portrait layout.
- View is distorted meaning blocks become close to each other. This is also due to as width is smaller now as mention above with LHS point.
If I remove the autorotate code, then simulator opens in Portrait orientation and view is not distorted.
Can you please explain why could this be happening?
Aucun commentaire:
Enregistrer un commentaire