2012-10-09 88 views
3

我一直在使用的Xcode 4.4爲我的項目爲iOS和我希望我的屏幕之一是永久的風景,所以我用更改爲橫向在Xcode 4.5的iOS 6.0與狀態欄

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation 
{ 
    return (interfaceOrientation == UIInterfaceOrientationLandscapeRight); 
} 

和它的工作就好,因爲我更新到4.5的Xcode和iOS 6.0並沒有在所有的工作,所以我發現我必須使用新的功能,現在我有:

- (NSUInteger)supportedInterfaceOrientations { 
     return UIInterfaceOrientationMaskLandscapeRight; 
} 

- (BOOL)shouldAutorotate { 
     return YES; 
} 

所以現在我的屏幕是橫向的,但狀態欄保持原位,就像屏幕仍處於肖像模式一樣。

我不知道如何解決它。

謝謝。

回答

1

我實現了這個到viewWillAppear中的功能和它在iOS6的工作:

[[UIApplication sharedApplication] setStatusBarOrientation:UIInterfaceOrientationLandscapeRight animated:YES];

+0

太好了!它也適用於我 –