嗨,我已經開發出將完全在橫向模式下運行一個iPad應用程序,然後安裝在iOS 6中的相同的應用程序也被迫在縱向模式下運行,所以我在我的代碼,通過它ICAN在兩個運行我的應用程序在橫向模式下添加幾件事情ios6及更低版本。但我的問題是我旋轉後,然後我推到下一個視圖風景右轉到左側的風景。如果我不旋轉然後沒有問題,它完美的作品。即使我旋轉也應該工作完美請幫我做到這一點。如何爲橫向左側和橫向右側設置狀態欄方向?
鑑於沒有負載我給下面的行。
- (void)viewDidLoad {
[super viewDidLoad];
if (IOS_OLDER_THAN_6)
[[UIApplication sharedApplication] setStatusBarOrientation:UIDeviceOrientationLandscapeLeft animated:NO];
//[[UIApplication sharedApplication] setStatusBarOrientation:UIInterfaceOrientationLandscapeRight animated:NO];
}
然後,我用下面的行替換了應該自動旋轉。
我將檢查IOS版本,如果它小於6 I加入下面線
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation{
return (toInterfaceOrientation == UIInterfaceOrientationLandscapeLeft) ||(toInterfaceOrientation == UIInterfaceOrientationLandscapeRight);
}
如果IOS版本是6和上述我會給的代碼的下面行
-(BOOL)shouldAutorotate
{
return YES;
}
- (NSUInteger)supportedInterfaceOrientations
{
return UIInterfaceOrientationMaskLandscape;
}
在我剛纔提到,它應該同時支持landscapeleft和景觀的權利,但在viewDidLoad中我提到只留下山水,這樣的問題是上面的代碼。有些人指導我爲左右景觀和左右景觀定位。即使嘗試給兩個方向,但沒有改變,所以我評論了一個。這是我的問題的原因。請有人幫我解決這個問題。
謝謝。它對我來說很好。在模擬器中它也能很好地工作..謝謝。 –