我找到了许多与我的问题相关的答案,但没有人可以帮助我解决我的问题。
正如我的标题所说,iOS 6 中的状态栏方向没有改变。我为更改状态栏方向编写了正确的代码,但它对我不起作用。它不适用于 iOS 模拟器和设备 (iPad)。
在我的 rootviewcontroller 中,我使用 UIInterfaceOrientationMaskAll 实现了与下面的代码相同的代码,之后,我使用 presentModelViewController 带来子视图控制器,但在子视图控制器中我无法更改状态栏方向。
我也实施了
-(NSUInteger)application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window
{
return UIInterfaceOrientationMaskAll;
}
在 AppDelegate 中。
我的代码是:
-(BOOL) shouldAutorotate
{
return YES;
}
- (NSUInteger)supportedInterfaceOrientations
{
return UIInterfaceOrientationMaskPortrait;
}
-(void)viewDidAppear:(BOOL)animated
{
[super viewDidAppear:animated];
[[UIApplication sharedApplication] setStatusBarOrientation:UIInterfaceOrientationPortrait];
}
请帮我解决这个问题。