作者larry122 (larry122)
看板MacDev
標題[問題] 關於Button highLight的顏色
時間Tue Jun 14 21:32:21 2016
各位好:
先附上DEMO
https://drive.google.com/file/d/0Bx3rZLw6NauYZWFTQ1ZBaFNZQVE/view?usp=sharing
現在遇到一個問題是我製作了一個TABLEVIEW 然後HIGHTLIGHT的時候
會將背景轉紅色,並也新增BUTTON想要達成同樣的效果,在stackoverflow
網站找到下方這個方法
- (UIImage *)imageWithColor:(UIColor *)color {
CGRect rect = CGRectMake(0.0f, 0.0f, 1.0f, 1.0f);
UIGraphicsBeginImageContext(rect.size);
CGContextRef context = UIGraphicsGetCurrentContext();
CGContextSetFillColorWithColor(context, [color CGColor]);
CGContextFillRect(context, rect);
UIImage *image = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
return image;
}
是可以轉變顏色,兩者同樣是red但Button的效果卻灰掉了,導致變成暗紅,自己嘗試了
很久仍然一樣,不確定BUTTON的HIGHTLIGH是如何運作的,想問一下有人遇過類似問題嗎?
不好意思 ,麻煩了
--
※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 61.230.13.78
※ 文章網址: https://www.ptt.cc/bbs/MacDev/M.1465911144.A.8A6.html
推 BS0824: Button type改成custom 06/15 09:45
→ larry122: 這樣就好嗎 下午來用看看 06/15 12:35
→ larry122: 可以了欸 用超久 原來在這改 06/15 13:40
→ larry122: 再次感謝1樓 花了不少時間嘗試把HIGHTLIAGHT關閉 06/15 21:25
→ BS0824: 舉手之勞 :) 06/16 08:57