2011-10-03 36 views
0

我有一個帶有3個子視圖(3 UIViewController)的UIViewController視圖的iPad應用程序。如果我以portait的方向呈現或解散模態視圖控制器,我將獲得具有正確框架的視圖控制器。如果我以橫向方向呈現或解散模態視圖控制器,則會得到錯誤的幀(「{{0,-256},{748,1024}}」)。以橫向方向呈現或解除模式視圖控制器

+0

你使用SplitViewController嗎? – shannoga

+0

不。我正在手動管理三個子視圖。 – radon90

+0

即使您打開和關閉模式視圖控制器的方向相同或僅在更改後纔會發生這種情況嗎? – shannoga

回答

0

我收到了同樣的問題。我懷疑這是因爲我們正在手動管理視圖層次結構,並且沒有正確計算方向更改。我會發布任何補充發現,但到目前爲止,我發現你可以糾正模式視圖控制器後,它是這樣呈現:

// Display modal dialog view controller "detailNav" 
[self presentModalViewController:detailNav animated:YES];  
// Create a custom frame for this view, optional, but needs to be set after presenting 
detailNav.view.superview.frame = customRect;     
// Recenter the view, for example to the center of your apps main window 
CGPoint center = myApp.window.center; 
detailNav.view.superview.center = center; 
相關問題