2013-10-14 150 views
0

我有一個特定的viewcontroller,我希望這樣的行爲: 加載時,如果設備是園景,顯示風景,但沒有自動旋轉。 加載時,如果設備是縱向,顯示縱向但不自動旋轉。 我找不到合適的解決方案,可以提供任何建議嗎?禁用自動旋轉

+0

看看這裏https://developer.apple.com/library/ios/featuredarticles/ViewControllerPGforiPhoneOS/Resp ondingtoDeviceOrientationChanges/RespondingtoDeviceOrientationChanges.html – mcy

回答

0

嘗試檢查viewWillAppear()上的版本,然後根據定向設置視圖以顯示您想要的方式。

int orientationType = [[UIDevice currentDevice] orientation]; 

1 =肖像2 =肖像(倒掛)3 =橫向()4 =橫向(

禁用自動旋轉對剛纔的圖:

- (BOOL) shouldAutorotate { 
    return NO; 
} 
+0

不起作用:/ –

+1

發生了什麼?你能告訴我更多細節嗎? –

+0

@RoyKronenfeld。 –