I always get stuck with managing rotation on iOS application, there must be some kind of efficient way to do it but apparently I haven’t heard of it yet. My interface is too complex to be parametrized in InterfaceBuilder so I tried doing all these different things:
- Build two interfaces, one for portrait and one for landscape, but I found it awfully tiresome to devise some methods that enable one view controller to keep up with the other, so when the device is rotated the second view controller knows where to pick up the story.
- Change my views’ frames manually inside
willRotateToInterfaceOrientation:, but in this scenario my whole interface turns into a bloody mess quite randomly (while sometimes it does the job alright…)
What do you think best practices are? Where might have I gone wrong? What did I miss? Thx!
I always go for the second option and it has never let me down. If you do it right, you will have always the expected result. What I think it’s happening to your application (and you call it bloody mess quite randomly) its because your
UIView'swill probably still have some autoresize definitions on the Interface Builder. Besides removing all the autoresizes I also uncheck the “Autoresize subviews” checkmark from the parentUIViews.