In AppDelegate.swift
, in application(_:didFinishLaunchingWithOptions:)
I put the following:
UINavigationBar.appearance().barTintColor = UIColor(red: 234.0/255.0, green: 46.0/255.0, blue: 73.0/255.0, alpha: 1.0)
UINavigationBar.appearance().tintColor = UIColor.white
UINavigationBar.appearance().titleTextAttributes = [NSAttributedString.Key.foregroundColor : UIColor.white]
(For Swift 4 or earlier use NSAttributedStringKey
instead of NSAttributedString.Key
)
For titleTextAttributes
, the docs say:
You can specify the font, text color, text shadow color, and text
shadow offset for the title in the text attributes dictionary
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…