2013-11-10 30 views
2

使用iOS7時,即使應用程序的「常規」下的「設備方向」設置爲橫向和縱向。我的應用程序中有一些屏幕,我不想旋轉。以每個視圖爲基礎的屏幕旋轉

如何選擇當設備轉動時旋轉哪些視圖?

我試圖使用shouldAutorotateToInterfaceOrientation,但我無法讓它工作。

任何人使用新軟件完成此任務?

回答

0

嘗試覆蓋- (BOOL)shouldAutorotate並返回NO

1

請在視圖中嘗試以下代碼,使其只成爲橫向並將橫向部分更改爲縱向,然後將其視爲只是縱向的視圖。

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

-(NSUInteger)supportedInterfaceOrientations 
{ 

return UIInterfaceOrientationMaskLandscape; 
} 

- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation 
{ 
return UIInterfaceOrientationLandscapeLeft; 
} 
+0

不幸的是,似乎很多人都對這個問題有同樣的問題。嘗試了幾個解決方案,但沒有運氣。 – Anthony