我有一個應用程序,它具有UIViewController
作爲根視圖控制器(不是TabBar
或NavigationController
應用程序!)。這個程序是通用的。它應該始終是iPhone的肖像,並始終是iPad的風景。通用應用程序中的iOS 6.0方向問題
我試過以下,但我認爲這是iOS 5的代碼,因爲它沒有被稱爲iOS 6中:
- (BOOL)shouldAutorotate
{
return YES;
}
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone)
{
return (interfaceOrientation == UIInterfaceOrientationPortrait);
}
else
{
return (interfaceOrientation == (UIInterfaceOrientationLandscapeLeft | UIInterfaceOrientationLandscapeRight));
}
}
任何幫助表示讚賞!
請閱讀'UIViewController'的文檔。從iOS 6開始,方向更改處理有所不同。文檔涵蓋了這些更改。關於這個話題也有許多現有的問題。 – rmaddy 2013-03-18 20:05:05
它實際上是一個混合:D shouldAutorate是ios6,其他ios5 – 2013-03-18 20:25:20
正在使用xib或故事板? – 2013-03-18 20:37:49