我使用IF語句來檢測設備的方向何時發生更改以及何時發生,會顯示一個新視圖,一個肖像,另一個環境。唯一的問題是,如果我從肖像旋轉到風景,並且風景視圖顯示,它並未一直旋轉。它仍然是肖像,它應該是90度。謝謝你的幫助!視圖不能正確旋轉
- (void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration {
if (toInterfaceOrientation == UIInterfaceOrientationPortrait || toInterfaceOrientation == UIInterfaceOrientationPortraitUpsideDown) {
//portrait
self.view = portrait;
} else {
//landscape
self.view = landscape;
}
}
完美,謝謝! –