我有一個類似的problem,其中視圖不會自動旋轉。我沒有解決方案,但我有一個解決方法。在您的視圖控制器的willRotateToInterfaceOrientation,旋轉明確的觀點:
switch (toInterfaceOrientation) {
case UIInterfaceOrientationLandscapeLeft:
self.view.transform = CGAffineTransformMakeRotation(M_PI * 0.5);
break;
case UIInterfaceOrientationLandscapeRight:
self.view.transform = CGAffineTransformMakeRotation(M_PI * -0.5);
break;
case UIInterfaceOrientationPortrait:
self.view.transform = CGAffineTransformMakeRotation(0);
break;
case UIInterfaceOrientationPortraitUpsideDown:
self.view.transform = CGAffineTransformMakeRotation(M_PI * 1);
break;
default:
break;
}
我打電話解決類似的問題,因爲我覺得視圖應該沒有明確的CGAffineTransformMakeRotation呼叫自動旋轉。在我的情況下,我正在實例化一個不同的風景視圖,我需要這樣旋轉。我有其他項目,其中單獨的視圖自動旋轉。我不知道爲什麼它不這樣做。
您的自動調整口罩如何設置? –
self.menuTableView.autoresizingMask = UIViewAutoresizingFlexibleHeight;類似的東西?在shouldAutorotateToInterfaceOrientation中,我應該在哪裏放置這個...?我把它放在它裏面,但它似乎沒有太大的作用,所以我只是把它刪除了 –
把它放在viewDidLoad中,並用所有的自動修復掩碼來嘗試它。使用:'self.menuTableView.autoresizingMask = UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleRightMargin | UIViewAutoresizingFlexibleTopMargin | UIViewAutoresizingFlexibleBottomMargin' – jere