我正在尝试将状态栏的方向修改为纵向,但未成功。我试过了:
[application setStatusBarOrientation:UIInterfaceOrientationPortrait animated:NO];
并且shouldAutorotateToInterfaceOrientation
也设置为返回NO
。
请帮帮我。
答案 0 :(得分:1)
如果要在显示特定视图时更改方向,则应在[UIViewController viewWillAppear:]覆盖方法中为每个强制特定方向的视图控制器调用[UIApplication setStatusBarOrientation:animated:]。当视图被推入堆栈时以及当它被弹出时,这将导致更改。确保在覆盖方法中调用super。
同时更改你的shouldAutorotateToInterfaceOrientation方法:
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
return UIInterfaceOrientationIsPortrait(interfaceOrientation);
}