更改文本颜色的可能解决方案包括在UIMenuController中使用UIButton的外观代理.问题是它直接使用Apple在菜单控制器中使用的私有UIButton子类.我永远不会建议访问私有Apple类(以及通过其名称),但在特定的菜单控制器颜色定制案例中,我认为这是最好的解决方案.它允许您定义视图外观的干净方式.
迅速
(NSClassFromString("UICalloutBarButton")! as! UIButton.Type).appearance().setTitleColor(UIColor.redColor(), forState: UIControlState.Normal)
Run Code Online (Sandbox Code Playgroud)
Objective-C的
[[NSClassFromString(@"UICalloutBarButton") appearance] setTitleColor:[UIColor redColor] forState:UIControlStateNormal];
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
2990 次 |
| 最近记录: |