开发者

iOS - Rotation with a Nav Controller

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜