更改导航控制器颜色迅速

我想将导航栏色调控制器颜色更改为颜色:R:73,G:155,B:255,A:0.7

直到现在,我只能将其更改为系统中的颜色。 以下是代表中的示例:

func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: NSDictionary?) -> Bool { UINavigationBar.appearance().barTintColor = UIColor.blueColor() UINavigationBar.appearance().tintColor = UIColor.whiteColor() return true } 

此外,我希望能够将导航视图控制器标题颜色更改为白色!

如果可能,我想将标签栏色调颜色更改为R:73,G:155,B:255,A:0.7,并将其文本更改为白色。

如果要设置导航栏的背景颜色:

 UINavigationBar.appearance().barTintColor = UIColor.redColor() 

注意RGB值从0.0到1.0,因此您必须将它们除以255,否则颜色将为白色。 下一个色调:

 UINavigationBar.appearance().tintColor = UIColor(red: 73.0 / 255.0, green: 155.0 / 255.0, blue: 255.0/ 255.0, alpha: 1.0) 

然后设置标题文字:

 UINavigationBar.appearance().titleTextAttributes = [NSForegroundColorAttributeName: someColor, NSFontAttributeName: someFont] 

最后为条形按钮项:

 UIBarButtonItem.appearance().setTitleTextAttributes([NSForegroundColorAttributeName: color, NSFontAttributeName: buttonFont], forState: UIControlState.Normal)