作者whitefur (白毛)
看板MacDev
标题[问题] UIButton image 翻转
时间Tue Oct 29 15:41:24 2013
我把image做翻转
再设给UIButton
达到"把UIButton的image翻转的效果"
UIImage *image = [UIImage imageWithCGImage:[UIImage imageNamed:@"xxx"].CGImage
scale:2.0
orientation:UIImageOrientationUpMirrored];
[_btn setImage:image forState:UIControlStateNormal];
但是在按下btn之後(UIControlStateHighlight)
image的方向却是跟翻转前的一样
http://imgur.com/fSyU9J6
可是如果用
[_btn setImage:image forState:UIControlStateHighlight];
就不会有「变灰」的效果
请问该如何让highlight状态同时有「翻转」及「变灰」的效果?
感谢
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 114.36.60.160
1F:→ tom19830924:叫Art做新图? 或是改原图Context Alpha? 10/29 18:03
2F:推 ahchie:试试[_btn setBackgroundImage:image forState:highlight]? 10/29 18:14
3F:→ whitefur:楼上的方法试过了 10/29 19:43
4F:→ yuanruo:继承uibutton 覆写touch事件? 10/29 22:49
5F:→ yuanruo:或是UIcontrol的 setHighlighted: (BOOL) highlighted 10/29 22:58