UIButton选择颜色 [英] UIButton selection color
本文介绍了UIButton选择颜色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我绘制自定义一个UIButton,并且当它被突出显示时想要设置蓝色。我如何实现这个?
I am drawing custom a UIButton and want to set the blue color when it is highlighted. How can I achieve this?
UIButton *myButton = [UIButton buttonWithType:UIButtonTypeCustom];
[myButton setBackgroundImage:[[UIImage imageNamed:@"test.png"] stretchableImageWithLeftCapWidth:100 topCapHeight:0] forState:UIControlStateNormal];
推荐答案
您可以尝试使用其他图片。您也可以参考以下链接:
You can try to use another image to do the job. You can also refer to this link:
这篇关于UIButton选择颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文