2016-09-26 104 views
0

Gif of the effect延遲UINavigationBar的外觀效果

背景:我的應用程序使用火力地堡作爲後端,偵聽狀態改變到當前用戶,並且,在記錄時,將上述控制器作爲根視圖控制器。它是包含若干UINavigationControllersUITabBarController。在它出現之前,我通過UINavigationBar.appearance()來設置導航欄的樣式。我注意到加載行爲有兩件事:

  • 在包含的內容之後加載條。
  • 你可以看到從一個無風格的導航欄出現的分界線,這使我相信默認外觀有某種延遲。

有沒有人遇到類似這樣的事情?我的目標是讓控制器一次完全加載,理想情況下不會看到分隔線。

func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool { 
    Appearance.shared.configure() // All UINavigationBar-related styling 

    window = UIWindow(frame: UIScreen.mainScreen().bounds) 
    window?.backgroundColor = UIColor.whiteColor() 
    window?.rootViewController = UIViewController() 
    window?.makeKeyAndVisible() 

    configureFirebase() // Listens for FIRAuth change, then sets window.rootViewController = MyTabBarController() 
    return true 
} 
+0

在用戶登錄 – ronan

+0

後添加了一些相關的代碼,以展示視圖控制器。一旦登錄,我只需重新設置'window.rootViewController'。 – Connor

回答

0

請嘗試移動UINavigationBar.appearance()代碼到你的AppDelegatedidFinishLaunchingWithOptions方法。

+1

這就是代碼當前的位置。 – Connor