在应用程序中为所有UIButton设置默认色调颜色 [英] Set default tint color for all UIButtons in an app
本文介绍了在应用程序中为所有UIButton设置默认色调颜色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我的iPad应用程序我有一些UIButtons,当按下时变为蓝色默认。我可以通过每一个和设置tintcolor使用:
[buttonName setTintColor:[UIColor colorWithRed:151 / 255.0f green: 202 / 255.0f blue:86 / 255.0f alpha:1.0]];
但是有没有更改默认和所有按钮的颜色?
$ b解决方案
使用UIAppearance协议:
[UIButton appearance] setTintColor:[UIColor colorWithRed:151 / 255.0f green:202 / 255.0f blue:86 / 255.0f alpha: 1.0]];
My iPad app I has a number of UIButtons that when pressed turn blue by default. I could go through each one and set the tintcolor using:
[buttonName setTintColor:[UIColor colorWithRed:151/255.0f green:202/255.0f blue:86/255.0f alpha:1.0]];
But is there anyway of changing this colour by default and for all buttons?
Is there anyway of changing this colour?
解决方案
Use the UIAppearance Protocol:
[[UIButton appearance] setTintColor:[UIColor colorWithRed:151/255.0f green:202/255.0f blue:86/255.0f alpha:1.0]];
这篇关于在应用程序中为所有UIButton设置默认色调颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文