2012-09-26 52 views
3

我們有一個ipad應用程序,支持landsace的左右方向。ios 6旋轉後的模態視圖大小不正確

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { 
    // Overriden to allow any orientation. 
    return (interfaceOrientation == UIInterfaceOrientationLandscapeLeft || interfaceOrientation == UIInterfaceOrientationLandscapeRight); 
} 

我們展示視圖控制器爲模態的視圖通過調用

childController.modalPresentationStyle = UIModalPresentationPageSheet; 
    childController.modalTransitionStyle = UIModalTransitionStyleCoverVertical; 
[parentController presentViewController:childController animated:childController.animated completion:^{ 
     childController->isBeingShowed = FALSE; 

當我們都在同一個模式的看法:RootViewController的(全屏) ​​- > SelectOption(500,500)的旋轉工作正常,並選擇相應的選項視圖控制器具有原始大小。

當我們顯示額外的模式視圖:RootViewController(FullScreen) - > SelectOption(500,500) - >其他選項(300,300),旋轉後SelectOption視圖控制器大小改變爲全屏,而AdditionalOptions視圖控制器保持它的尺寸如指定。

+0

你可以找到在http://stackoverflow.com/questions/12554204/ios-6-rotation-issue-no-rotation-from-presented-modal-view-controller – freytag

+0

的答案,我問在這裏回答同樣的問題:http://stackoverflow.com/a/14989999/1742521希望它有幫助。 –

+0

感謝您的鏈接,但這不是同一個問題。模態視圖的方向會根據情況進行更改,但如果模態視圖的父級具有相同的演示樣式,則會變爲全屏 –

回答

1

問題是用小把戲解決的。

他們的問題根源在於,我打開第一個模式視圖爲PageSheet,當我打開第一個模式視圖時,我得到了MainView(FullScreen),作爲頁面打開的模式視圖,以及第二頁表單從前一頁打開。這種架構引起了旋轉問題。

訣竅:現在我打開第二個模態視圖爲FormSheet,重新計算座標以對應PageSheet座標系。所以現在看起來像這個MainView-> PageSheet-> FormSheet和問題已修復。

對不起,沒有代碼。