Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

newtoiphonesdk

macrumors 6502a
Original poster
Jul 30, 2010
567
2
My root view is a Tab Bar Controller.

In this tab view, I do not want any tabs to rotate. However, some of the Tab Bar Items are Navigation Controllers, that present different pdf documents. I would like those to rotate. However, I set the ViewController Classes for those views to return YES on shouldAutorotate method, yet they refuse to rotate.

I present them using
Code:
        [self.navigationController pushViewController:_webViewController animated:YES];

_webViewController is allowed to rotate, but won't.

I have also tried presenting Controller Modally, but that will not work either. Any thoughts?
 
Unless I'm mistaken, rotation limits are kind of inherited, aren't they?

So if one view in the hierarchy can't have a certain rotation, anything under it also can't have that rotation. So either your tabs have to rotate or nothing can. I think. It seems like I had that issue a month or two ago and that was my finding.
 
Unless I'm mistaken, rotation limits are kind of inherited, aren't they?

So if one view in the hierarchy can't have a certain rotation, anything under it also can't have that rotation. So either your tabs have to rotate or nothing can. I think. It seems like I had that issue a month or two ago and that was my finding.
Yet there are other apps that get by this like Twitter. In iPhone, if you click a tweet and then a URL in that tweet, a controller gets pushed that can rotate, while nothing else can.
 
As I understand it, you want only certain elements to rotate while the tab bar it self stays in place. I do this in my CameraTime app. See the first two screen shots. Notice how the i and record buttons always are vertical.

I learned the trick via Stackoverflow from this post. In case you are not taken to the best answer, the responder was Corey Floyd.

The key is setting up the device to generate rotation notifications, listen for them, and act upon them.
Code:
[[UIDevice currentDevice] beginGeneratingDeviceOrientationNotifications];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(detectOrientation) name:@"UIDeviceOrientationDidChangeNotification" object:nil];

When you do have rotation issues, it may be a good idea to review Why won't my UIViewController rotate with the device?

Apple also has a WWDC 2012 video titled "Session 240 - Polishing Your Interface Rotations".
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.