目前我只有在iPhone應用程序中的肖像模式。我想在應用程序中允許一個控制器的橫向模式,但不幸的是我無法使其工作。iPhone應用程序風景模式不起作用
我在plist文件有以下設置:
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationLandscapeRight</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
</array>
而且我實現我的控制器來使用這些方法:
-(BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
return (interfaceOrientation != UIInterfaceOrientationPortraitUpsideDown);
}
-(NSUInteger)supportedInterfaceOrientations
{
return UIInterfaceOrientationMaskAllButUpsideDown;
}
-(BOOL)shouldAutorotate
{
return YES;
}
我使用導航控制器的應用程序,所以我意識到,這可能是問題。我分類UINavigationController
並再次以上述相同的方式實施shouldAutorotateToInterfaceOrientation
,supportedInterfaceOrientations
和shouldAutorotate
。當然,我使用subclassed導航控制器來顯示控制器應該有旋轉能力。我也嘗試按類別覆蓋導航控制器的方法,但它也不起作用。
我從一開始就不在應用程序上工作,我繼承了代碼。如果有可能如何限制全球景觀這可能是我的情況。爲了測試我使用iPhone 6.0模擬器,但我的部署目標是5.0。我感謝任何提示/幫助。
http:// stackoverflow。com/questions/12600082/set-orientation-to-landscape-mode-in-xcode-4-5-gm-ios-6 – Rushabh