1

我有SplitViewController項目。在詳細的窗格(右側),在方法 - viewDidAppear,我有這樣的代碼:警告,同時解僱和呈現FullScreen ModalViewController

login.modalPresentationStyle = UIModalPresentationFullScreen; 
login.modalTransitionStyle = UIModalTransitionStyleCrossDissolve; 

在「登錄」 ViewController我有一個按鈕,點擊時,進入這個方法:

-(void)registerEvent{ 
NSLog(@"registerEvent"); 
[self dismissViewControllerAnimated:YES completion:^{ 
[_delegate dismissLogin]; 
}]; 
} 

而且在我的委託ViewController(該detailViewController)的方法,我有這樣的代碼:

-(void)dismissLogin{ 
ViewControllerRegister * registerForm = [ViewControllerRegister new]; 
[registerForm setDelegate:self]; 

registerForm.modalPresentationStyle = UIModalPresentationFullScreen; 

registerForm.modalTransitionStyle = transition; 

[self presentViewController:registerForm animated:YES completion:nil]; 
} 

的問題是,如果我改變了模態PRES entation樣式爲UIModalPresentationFormSheet,編譯器給我沒有警告,並提供registerForm ViewController。但隨着UIModalPresentationFullScreen,編譯器給了我這樣的警告:

警告:試圖提出有關 而呈現在 進步!

我已經嘗試使用performSelector延遲0.4,仍然不能解決問題。

我該如何解決這個問題?

感謝

回答

0

我相信,這意味着你的觀點已經呈現的東西,它不能出現在它的頂部另一種觀點。

+0

謝謝。我發現,當我們用UIModalPresentationFullScreen呈現一個VC時,當您關閉VC時,父VC將在方法ViewDidLoad中啓動。但是,如果您使用其他UIModelPresentations(例如:UIModelPresentationFormSheet),則父VC不會初始化ViewDidLoad。 –

+0

而這是因爲在全屏模式下呈現佔據了整個屏幕,所以當它被解散時需要在父屏幕上調用viewDidLoad,因爲它需要重新繪製整個屏幕。我很高興我能幫上忙! –

相關問題