tags:

views:

39

answers:

2

I've got an app that has two parts. Basically, the first part shows a bunch of image thumbnails. When you tap an image thumbnail, a full view of that image pops up inside a UIScrollView, filling the screen, with some buttons on top of it for performing various actions.

I want the main page with the thumbnails to always be in Portrait mode. But I want the two subviews -- the scrollview containing the image, and the uiview containing the buttons -- to autorotate when the user switches orientations.

I've tried having the View Controller for the main view return NO for the shouldAutorotateToInterfaceOrientation method, and then having the two subviews' controllers return YES, but then NOTHING rotates.

Is it possible to have only those two subviews respond to rotation events? How?

+1  A: 

How are you presenting the scroll view and buttons? Strictly speaking, they should be managed by the same controller, presented modally over your first view controller. The autorotation system relies on whatever it thinks is the "main" view controller, which, in this case—assuming you're not actually using -presentModalViewController:animated:, as it doesn't sound like you are—remains the controller that's displaying the thumbnails. In other words: have one view controller set up the scroll view containing the full image and the action buttons, and, when the user taps a thumbnail in the main view, present that view controller.

Noah Witherspoon
Ahhhhhh. That makes a lot of sense. For some reason, despite the fact that what I'm dealing with is clearly a modal interface, it didn't dawn on me to use a modal view controller! I'll give it a shot.
DanM
That did it! Thanks.
DanM
+1  A: 

I think you can register as an observer for this notification, UIApplicationWillChangeStatusBarOrientationNotification

This notification is in the UIApplication Class Reference. When the application is about to change the orientation of its interface, the notification is posted.

Toro