2014-09-26 59 views
1

我試圖將狀態欄放在正確的風景中,而它始終處於縱向位置。難道我做錯了什麼?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; 
} 

回答

0

您的內容是否包裹在UINavigationController?如果是這樣,嘗試繼承了UINavigationController並覆蓋prefersStatusBarHidden

- (BOOL)prefersStatusBarHidden 
{ 
    return NO; 
} 

可能的工作?