0

我正在尝试将状态栏的方向修复为纵向,但没有成功。我努力了:

[application setStatusBarOrientation:UIInterfaceOrientationPortrait animated:NO]; 

并且还shouldAutorotateToInterfaceOrientation设置为 return NO

请帮帮我。

4

1 回答 1

1

If you want to change the orientation when a particular view is showing, you should call [UIApplication setStatusBarOrientation:animated:] inside your [UIViewController viewWillAppear:] override method for each of the view controllers that force a particular orientation. That will cause a change when a view is being pushed onto the stack and when it's being popped off it. Make sure you call super in your override method.

Also change your shouldAutorotateToInterfaceOrientation method:

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
   return UIInterfaceOrientationIsPortrait(interfaceOrientation);
}
于 2012-08-20T08:46:37.003 回答