iOS 8方向横向状态栏问题

时间:2014-09-26 14:00:37

标签: ios landscape

我正在尝试将状态栏置于正确的横向状态,同时它始终处于纵向位置。我做错了吗?

或者我可以在特定页面的右侧横向上运行状态栏吗?

    [[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;
}

1 个答案:

答案 0 :(得分:0)

您的内容是否包含在UINavigationController中?如果是,请尝试继承UINavigationController并覆盖prefersStatusBarHidden

- (BOOL)prefersStatusBarHidden
{
    return NO;
}

那可能有用吗?

相关问题