1

我在iOS 8上構建應用程序,並在UIViewController與modalPresentationStyle = UIModalPresentationPageSheet一起呈現時出現狀態欄可見性問題。我閱讀了文檔,提供了modalPresentationCapturesStatusBarAppearance用於隱藏狀態欄的新API的真實值,但在此模式呈現方式中我沒有得到任何結果。在我的應用程序中,我沒有顯示狀態欄。它在iOS 7中使用這種風格工作得很好,但是當涉及到iOS 8時,它會產生問題。這裏是我的代碼:iOS 8隱藏狀態欄的UIModalPresentationPageSheet

UINavigationController *nav = [[UINavigationController alloc] initWithRootViewController:viewController]; 
nav.modalPresentationStyle = UIModalPresentationPageSheet; 
nav.modalTransitionStyle=UIModalTransitionStyleCoverVertical; 
nav.modalPresentationCapturesStatusBarAppearance = YES; // To hide status bar, doest work with UIModalPresentationPageSheet style 
[self.navigationController presentViewController:nav animated:YES completion:NULL]; 

我得到這樣的:

enter image description here

但所需的輸出是

enter image description here

請幫助!

+0

您是否發現此問題的修復?我也有隱藏PageSheet樣式和狀態欄的ios8問題。謝謝 – rwyland 2015-02-03 00:44:30

回答

0

使用nav.modalPresentationStyle = UIModalPresentationPopover只有

+0

我已經使用你的建議,但現在得到這個錯誤。 「由於未捕獲的異常'NSGenericException'而終止應用程序,原因是:'UIPopoverPresentationController應該在演示發生之前設置非零的sourceView或barButtonItem。'」並且應用程序崩潰。 – Juno 2014-09-19 07:55:58