码迷,mamicode.com
首页 > 其他好文 > 详细

button设为UICustomType后点击无高亮效果

时间:2014-07-09 22:21:30      阅读:201      评论:0      收藏:0      [点我收藏+]

标签:问题   for   type   ui   c   image   

今天在cell上加了一个button,设了image

secondButton.buttonType = UIButtonTypeCustom;

[secondButton setImage:image_2 forState:UIControlStateNormal];

但是点击上去无高亮效果,经查找

发现两个问题

1、应该设backGroundImage

[secondButton setBackgroundImage:image_2 forState:UIControlStateNormal];

2、设置属性为YES

secondButton.showsTouchWhenHighlighted = YES;

修改了以上两点后,button就显示出高亮效果了。

button设为UICustomType后点击无高亮效果,布布扣,bubuko.com

button设为UICustomType后点击无高亮效果

标签:问题   for   type   ui   c   image   

原文地址:http://www.cnblogs.com/guatiantian/p/3829866.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!