It's a small but annoying issue. I'm using a navigation controller and it will not rotate. I was using the code before without a navigation controller and it was rotating beautifully. It isn't even calling "-(BOOL)shouldAutororateToInterfaceOrientation..." now so I'm at a bit of a loss.
Thanks in advance.
Edit: And yes I have "-(BOOL)canBecomeFirstResponder" set.
开发者_JAVA百科Edit2: I have it calling "-(BOOL)shouldAutororateToInterfaceOrientation..." now when the App first runs and at this point the screen is rotated but then when it shows the Navcontroller sets it back to portrait mode...
There's a problem with UIWindow
propagating these events to view controllers other than the root one. If you're adding this controller directly to a UIWindow
and it isn't the first one you've added, then add it to the root view instead.
Otherwise, you'll probably need to take a look at implementing your own rotation transformations. I've got a UIViewController subclass which does the heavy lifting for you on github here.
Your controller need to have return YES in:
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
// Overriden to allow any orientation.
return YES;
}
Also if you have an UITabBarController, each controllers need that method to return YES.
精彩评论