views:

14

answers:

0

I have a UIView displayed, oriented horizontally. It starts out vertically and the user has rotated the device 90 degrees. The main view within the root view is a UIScrollView with a content size equal to the height of the view and a large width.

Now, the view pushes a modal view on top.

Now the system receives a low memory warning. The main view controller releases its subview.

Now the modal view is popped off the stack. The main view controller receives a call to shouldAutoRotateToInterfaceOrientation: with the orientation it was already in (the user didn't rotate the device at all during the modal screen). The view controller returns YES.

Now... nothing. willRotateToInterfaceOrientation: is not called, presumably because it's already in that orientation. However, inside of willRotateToInterfaceOrientation: I set the content size of the UIScrollView based on the size of the root UIView. Since willRotateToInterfaceOrientation is never called, I can never setup the content size. I also set it in viewDidLoad: but at that point, the view has not yet rotated, so it still thinks it's in portrait.

I don't want to move this code into viewWillAppear since 90% of the time, it is unnecessary, and seems more like a hack than a fix. Is there any more "correct" way?