在WKWebView

时间:2017-11-20 16:50:34

标签: ios swift uibarbuttonitem wkwebview uitoolbar

我在appDelegate中使用此代码将我项目中导航栏的所有UIBarButtonItem的颜色更改为白色

let whiteAttr = [NSAttributedStringKey.font : UIFont(name: "OpenSans", size: 14)! ,NSAttributedStringKey.foregroundColor: UIColor.white]
UIBarButtonItem.appearance().setTitleTextAttributes(whiteAttr, for: .normal)
UIBarButtonItem.appearance().setTitleTextAttributes(whiteAttr, for: .highlighted)

但是WKWebView中我的ToolBar的Done按钮也是白色的,我该如何改变颜色呢?

1 个答案:

答案 0 :(得分:-2)

let BarButtonItemAppearance = UIBarButtonItem.appearance()
BarButtonItemAppearance.setTitleTextAttributes([NSAttributedStringKey.foregroundColor: UIColor.blue], for: .normal)