iOS 8方向风景状态栏问题
问题描述:
我试图将状态栏放在正确的风景中,而它始终处于纵向位置。难道我做错了什么?iOS 8方向风景状态栏问题
或者我可以在特定页面的右侧横向上运行状态栏?
[[UIApplication sharedApplication] setStatusBarOrientation:UIInterfaceOrientationLandscapeRight animated:NO];
我试过这段代码,但它没有奏效。
.h
UIViewController *currentVC;
.m
- (NSUInteger)supportedInterfaceOrientations
{
NSUInteger orientations = UIInterfaceOrientationMaskLandscapeRight;
if (vertical)
{
orientations = UIInterfaceOrientationMaskPortrait;
}
if (horizontal)
{
orientations = UIInterfaceOrientationMaskLandscapeRight;
}
return orientations;
}
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
return YES;
}
- (BOOL)shouldAutorotate
{
NSLog(@"shouldAutorotate");
return YES;
}
答
您的内容是否包裹在UINavigationController
?如果是这样,尝试继承了UINavigationController
并覆盖prefersStatusBarHidden
- (BOOL)prefersStatusBarHidden
{
return NO;
}
可能的工作?