views:

843

answers:

1

(Just so you know ,I'm learning to develop for iPhone without Interface Builder) I have an app with a root view controller, a blue view controller and yellow view controller. The root VC lazy-loads the blue and yellow VC's and displays the blue VC's view first, and then switches to the other one when a button in the toolbar at the bottom is pressed. I have all the autoresizingMasks set, so they rotate fine, but if say the blue view is being displayed, I rotate to landscape, its fine, but then when I switch views the yellow one is all messed up because its never auto-rotated, it starts out with portrait dimensions, and auto-rotates to landscape fine, but when it loads the normal portrait yellow view into the landscape view, everything is messed up, the yellow view never got auto-rotated with the rest because it wasn't even in view as a subview. So how can I fix this? Is there some way I can make it initialize as if it had already auto-rotated if it does need to be?

Thanks!!

+1  A: 

I solved this by making a initPortrait and initLandscape initialization methods for the view controllers, that just do a regular init and set the isPortrait BOOL to YES or NO, and then in view did load I set the frame differently depending on the value of isPortrait.

Mk12