私はUINavigationBarの外観を設定するメソッドを持っています。 FlightSearchViewControllerはUIViewControllerからサブクラス化されていますが、ナビゲーションバーは期待どおりに更新されません。 FlightSearchViewControllerの代わりにUIViewControllerを書くと、すべて正常に動作します。UIAavigationBarのUIA外観は、カスタムビューコントローラで使用すると機能しません...?
var navBarAppearanceControllers = [AnyObject.Type]()
navBarAppearanceControllers.append(FlightSearchViewController.self)
let navBarAppearance = UINavigationBar.appearanceWhenContainedInInstancesOfClasses(navBarAppearanceControllers)
navBarAppearance.barTintColor = UIColor.clearColor()
navBarAppearance.backgroundColor = UIColor.clearColor()
navBarAppearance.tintColor = UIColor.clearColor()
navBarAppearance.setBackgroundImage(UIImage(), forBarMetrics: .Default)
navBarAppearance.shadowImage = UIImage()
navBarAppearance.translucent = true
navBarAppearance.titleTextAttributes = [NSForegroundColorAttributeName : UIColor.whiteColor(), NSFontAttributeName: UIFont.ixiRegularFontOfSize(17)]
をして:
private class func setupNavigationBarAppearance() {
UINavigationBar.appearance().barStyle = .Black
UINavigationBar.appearance().translucent = false
UINavigationBar.appearance().titleTextAttributes = [NSForegroundColorAttributeName : UIColor.whiteColor(), NSFontAttributeName: UIFont.ixiRegularFontOfSize(17)]
UINavigationBar.appearance().tintColor = UIColor.clearColor()
UINavigationBar.appearance().barTintColor = Color.navBarThemeColor
var navBarAppearanceControllers = [AnyObject.Type]()
navBarAppearanceControllers.append(FlightSearchViewController.self)
let navBarAppearance = UINavigationBar.appearanceWhenContainedInInstancesOfClasses(navBarAppearanceControllers)
navBarAppearance.barTintColor = UIColor.clearColor()
navBarAppearance.backgroundColor = UIColor.clearColor()
navBarAppearance.tintColor = UIColor.clearColor()
navBarAppearance.setBackgroundImage(UIImage(), forBarMetrics: .Default)
navBarAppearance.shadowImage = UIImage()
navBarAppearance.translucent = true
navBarAppearance.titleTextAttributes = [NSForegroundColorAttributeName : UIColor.whiteColor(), NSFontAttributeName: UIFont.ixiRegularFontOfSize(17)]
}
特定のviewControllerのナビゲーションバーの色を変更しようとしています。右? –
はい.............その他 –