我試圖讓我的xib文件之一旋轉到肖像,就好像它是默認的第一個地方。如何使我的界面方向自動旋轉爲縱向?
我讓我的應用程序只支持風景方向。在plist中,我設置了「初始界面方向爲橫向(右側主頁按鈕)」,因爲大多數應用程序都是在橫向模式下運行的。
我在實現文件放置的代碼是:
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
// Return YES for supported orientations
return interfaceOrientation == UIInterfaceOrientationLandscapeLeft || interfaceOrientation == UIInterfaceOrientationLandscapeRight;
}
現在改變到需要的界面處於縱向模式視圖控制器時,我已經把在廈門國際銀行驗證碼文件的實現文件,以使其進入縱向模式並單獨支持縱向模式。因此,即使設備處於橫向模式,它仍會以縱向模式運行視圖。
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
// Return YES for supported orientations
return interfaceOrientation == UIInterfaceOrientationPortrait || interfaceOrientation == UIInterfaceOrientationPortrait;
}
儘管這似乎並沒有工作。它只是保持在橫向模式下,擠壓了我放在xib文件中的圖像視圖和其他對象。我如何讓xib旋轉到肖像模式?謝謝。
iOS 6已經添加了3種新的方法來方便界面旋轉,請檢查它們:http://stackoverflow.com/questions/12404556/interface-orientation-in -ios-6-0 –
哪個iOS版本和你如何改變viewController? – jcesarmobile
您使用哪種方法來獲取您的視圖.. pushviewcontroller或presentModalViewController – Rajneesh071