【发布时间】:2013-05-25 05:27:04
【问题描述】:
我找到了许多与我的问题相关的答案,但没有人可以帮助我解决我的问题。
正如我的标题所说,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];
}
请帮我解决这个问题。
【问题讨论】:
-
您在应用程序委托中将状态栏方向设置为纵向,在根视图中将视图设置为全部屏蔽。如果您在根视图中使用他的方法,则无需在应用程序委托中应用该方法。您是否尝试过在应用程序委托中注释掉方向方法,并查看状态栏是否使用仅在根视图中应用的方法改变方向?
标签: iphone ios objective-c ipad orientation