OGeek|极客世界-中国程序员成长平台

标题: ios - 如何更改 UIToolbar 按钮的标题颜色? [打印本页]

作者: 菜鸟教程小白    时间: 2022-12-12 12:11
标题: ios - 如何更改 UIToolbar 按钮的标题颜色?

有什么简单的方法可以改变 UIToolBar 按钮标题的标题颜色,就像我们在 UIBarButtonItem 中使用的那样:

[[UIBarButtonItem appearance] 
    setTitleTextAttributes:
        [NSDictionary dictionaryWithObjectsAndKeys:[UIColor redColor], 
            UITextAttributeTextColor,nil] 
    forState:UIControlStateNormal];



Best Answer-推荐答案


UITextAttributeTextColoriOS >= 7.0 中被弃用

使用 setTintColorUIColor *) 来改变按钮标题的颜色。

UIToolBar设置默认标题颜色:

[_myUIToolBar setTintColor:[UIColor redColor]];

或设置单个UIBarButtonItem的标题颜色:

[_myUIBarButtonItem setTintColor:[UIColor blueColor]];

关于ios - 如何更改 UIToolbar 按钮的标题颜色?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17486264/






欢迎光临 OGeek|极客世界-中国程序员成长平台 (http://ogeek.cn/) Powered by Discuz! X3.4