iOS 7 UIBarButton back button arrow color

后端 未结 17 1887
情话喂你
情话喂你 2020-12-04 06:30

I\'m trying to change the back button arrow

\"enter

I\'m currently using the

相关标签:
17条回答
  • 2020-12-04 06:51

    Just to change the NavigationBar color you can set the tint color like below.

    [[UINavigationBar appearance] setTintColor:[UIColor whiteColor]];
    
    0 讨论(0)
  • 2020-12-04 06:53

    In iOS 6, tintColor tinted the background of navigation bars, tab bars, toolbars, search bars, and scope bars. To tint a bar background in iOS 7, use the barTintColor property instead.

    iOS 7 Design Resources iOS 7 UI Transition Guide

    0 讨论(0)
  • 2020-12-04 06:53

    Update Swift 3

    navigationController?.navigationItem.rightBarButtonItem?.tintColor = UIColor.yellow
    navigationController?.navigationBar.tintColor = UIColor.red
    navigationController?.navigationBar.barTintColor = UIColor.gray
    navigationController?.navigationBar.titleTextAttributes =  [NSForegroundColorAttributeName: UIColor.blue]
    

    Result:

    0 讨论(0)
  • 2020-12-04 06:55

    I had to use both:

    [[UIBarButtonItem appearanceWhenContainedIn:[UINavigationBar class], nil] 
                         setTitleTextAttributes:[NSDictionary 
                   dictionaryWithObjectsAndKeys:[UIColor whiteColor], UITextAttributeTextColor,nil] 
                                       forState:UIControlStateNormal];
    
    [[self.navigationController.navigationBar.subviews lastObject] setTintColor:[UIColor whiteColor]];
    

    And works for me, thank you for everyone!

    0 讨论(0)
  • 2020-12-04 06:55

    Swift 2.0: Coloring Navigation Bar & buttons

    navigationController?.navigationBar.barTintColor = UIColor.blueColor()
    navigationController?.navigationBar.tintColor = UIColor.whiteColor()
    navigationController!.navigationBar.titleTextAttributes = [NSForegroundColorAttributeName: UIColor.whiteColor()]
    
    0 讨论(0)
提交回复
热议问题