我編程方式創建UINavigationController
:編程方式創建的UINavigationController與在UIStatusBar大標題瀑布
navigationController = UINavigationController(rootViewController: modeSelectVC!)
navigationController?.delegate = self
window.rootViewController = navigationController
window.makeKeyAndVisible()
然後定製我UINavigationBar
外觀像這樣:
navigationBarAppereance.barTintColor = UIColor.ColorPalette.bostonUniversityRed
navigationBarAppereance.tintColor = UIColor.ColorPalette.eerieBlack
navigationBarAppereance.barStyle = .black
navigationBarAppereance.isTranslucent = true
navigationBarAppereance.prefersLargeTitles = true
navigationBarAppereance.largeTitleTextAttributes = [NSAttributedStringKey.foregroundColor: UIColor.ColorPalette.babyPowder]
配置的UINavigationBar
隱藏在rootViewController
與狀態欄一起提供,但當rootViewController
推動另一個視圖控制器時,狀態欄和導航欄變得可見,如s ○:
結果是我編程它是但您還可以在上面看到,該back
按鈕錯位。如果我放棄喜歡的大標題,那麼後退按鈕就像往常一樣正確對齊,但爲什麼在使用大標題時會出現錯位。
我添加了這個:'func position(for bar:UIBarPositioning) - > UIBarPosition {return .topAttached}'但是很遺憾,問題仍然存在。 –
@CanSürmeli可能試試'navigationController.navigationBar.clipsToBounds = false'? –
不幸的是,再沒有。 –