Hop*_*ope 4 colors toolbar title swift
我们正在使用 Obj-C 更改工具栏按钮项目标题颜色
[_anyToolbarButton setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys: [UIColor lightGrayColor], NSForegroundColorAttributeName,nil] forState:UIControlStateNormal];
Run Code Online (Sandbox Code Playgroud)
但在使用 Swift 时我无法改变。
你可以用这种方式快速做到这一点:
_anyToolbarButton.setTitleTextAttributes([NSForegroundColorAttributeName: UIColor.lightGrayColor()], forState: .Normal)
Run Code Online (Sandbox Code Playgroud)