2016-06-30 32 views
1

我不明白這一點。在方法didFinishLaunchingWithOptions上,當我設置self.window.rootViewController = <instance of LoginViewController>時,它顯示爲滿意的登錄屏幕。但是當我將LoginViewController添加到NavigationController然後設置self.window.rootViewController = <instance of NavigationController>時,登錄屏幕頂部的一部分被隱藏了?爲什麼當將NavigationViewController添加到NavigationController時隱藏了LoginViewController的一部分?

Before adding into NavigationController

After adding into NavigationController

+0

隱藏設置導航欄。頂部隱藏的部分是導航欄。 – Signare

回答

0

的原因是,視圖的上部區域被覆蓋的導航欄,所以你可以用這個代碼

[[self navigationController] setNavigationBarHidden:YES animated:YES]; 
0

這是因爲它隱藏在默認情況下,導航控制器可以看到導航欄。爲確保導航欄隱藏在您的登錄屏幕中,您應該調用viewDidLoad()方法登錄屏幕視圖控制器self.navigationController?.setNavigationBarHidden(true, animated: false)

+0

沒錯。感謝您的回答 :) –

相關問題