如何更改UIBarButtonItem的tintColor?

我想将我的右栏button项目的颜色从黑色更改为白色。 这是一个button作为search图标。 我还没有对search实现进行编码,因为我想先完成主界面。 我以为我写了正确的代码,所以它应该显示为白色,但在故事板和模拟器中似乎仍然显示为黑色。

在故事板中,我也把它设置为白色。

这是我的代码,位于AppDelegate.swift文件中:

 func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool { // Changing the status bar's colour to white UIApplication.sharedApplication().statusBarStyle = .LightContent // Changing the navigation controller's background colour UINavigationBar.appearance().barTintColor = UIColor(red: 0.0/255.0, green: 165.0/255.0, blue: 227.0/255.0, alpha: 1.0) // Changing the navigation controller's title colour UINavigationBar.appearance().titleTextAttributes = [NSForegroundColorAttributeName: UIColor.whiteColor()] // Changing the colour of the bar button items UINavigationBar.appearance().tintColor = UIColor.whiteColor() // Changing the tint colour of the tab bar icons UITabBar.appearance().tintColor = UIColor(red: 0.0/255/0, green: 165.0/255.0, blue: 227.0/255.0, alpha: 1.0) return true } 

这里是模拟器的图像:

在这里输入图像说明

我发现这行代码不起作用是很奇怪的。 任何解决scheme

问题是该button被自动设置为自定义。 我将其重新configuration为系统。