NavigationBar bar, tint, and title text color in iOS 8

前端 未结 18 2324
星月不相逢
星月不相逢 2020-12-02 04:08

The background text in the status bar is still black. How do I change the color to white?

// io8, swift, Xcode 6.0.1 
override func viewDidLoad() {
    super         


        
18条回答
  •  盖世英雄少女心
    2020-12-02 04:44

    To work in objective-c I have to put the following lines in viewWillAppear in my CustomViewController.

    [self.navigationController.navigationBar setBarTintColor:[UIColor whiteColor]];
    [self.navigationController.navigationBar setTranslucent:NO];
    

    For Swift2.x this works:

    self.navigationController?.navigationBar.barTintColor = UIColor.redColor()
    

    For Swift3.x this works:

    self.navigationController?.navigationBar.barTintColor = UIColor.red
    

提交回复
热议问题