[iPhone] Nested UIViewControllers, InterfaceOrientation & Rotation
[iPhone] Nested UIViewControllers, InterfaceOrientation & Rotation
- Subject: [iPhone] Nested UIViewControllers, InterfaceOrientation & Rotation
- From: Brad Gibbs <email@hidden>
- Date: Thu, 25 Mar 2010 07:53:51 -0700
I've done some reading and some testing, but can't seem to make this work properly -- ie, I can't get a nested VC's interfaceOrientation property to update to the current interfaceOrientation of the device.
I've got a main UIViewController with code to support a toolbar with buttons across the top of its view and another toolbar and buttons across the bottom. In the middle of the screen is a view, called oTargetView, which is owned by the main UIViewController. The buttons on the toolbars launch other view controllers with views to occupy the middle of the screen -- their views are loaded into oTargetView. Rotation is a problem.
oTargetView autorotates and I can even get the views of the subview viewControllers to resize to fit oTargetView, but these subview viewControllers' interfaceOrientation properties don't seem to change.
interfaceOrientation is a read-only property, but, I thought that manually passing the willRotate and didRotate down to the subview viewControllers would cause the subview viewController to update its interfaceOrientation property. This doesn't seem to be the case. The logs show that an interfaceOrientation call to the subview viewController always returns 1, whether it's made in the willRotate method, in the didRotate method or, even in a separate method.
Is this the case? Or, am I doing something wrong?
If this is the case, does it mean that I can't rely on the subview VC's interfaceOrientation property? Do I just bypass this and make changes based on toInterfaceOrientation in willRotate and fromInterfaceOrientation in didRotate? Or, should I be using one of the other hacks out there (ie, relying on deviceOrientation notifications, or releasing and re-instantiating the subview VC on each rotation)?
FWIW, this seems like something Apple needs to fix in OS 4.0. Sending these calls to a single UIViewController seems to work for an iPhone app, but, the iPad has so much more screen real estate that it doesn't seem reasonable to not have nested VC's.
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden