让UIButton在按下时没有高亮效果
How are you setting the images for the different UIControlStates
on the button? Are you setting a background image for UIControlStateHighlighted
as well as UIControlStateSelected
?
UIImage *someImage = [UIImage imageNamed:@"SomeResource.png"];
[button setBackgroundImage:someImage forState:UIControlStateHighlighted];
[button setBackgroundImage:someImage forState:UIControlStateSelected];
If you're setting the selected state on the button touch down event rather than touch up inside, your button will actually be in a highlighted+selected state, so you'll want to set that too.
[button setBackgroundImage:someImage forState:(UIControlStateHighlighted|UIControlStateSelected];
Edit:
To sum up my remarks in the comments and to address the code you posted...you need to set your background images for the full UIControl
state that you're in. According to your code snippet, this control state would be disabled+selected+highlighted for the duration of the network operation. This means that you would need to do this:
[button setBackgroundImage:someImage forState:(UIControlStateDisabled|UIControlStateHighlighted|UIControlStateSelected];
If you remove the highlighted = YES
, then you would need this:
[button setBackgroundImage:someImage forState:(UIControlStateDisabled|UIControlStateSelected];
http://stackoverflow.com/a/1785059
最新文章
- ireport5.6+jasperreport6.3开发(二)--web开发的配置
- 使用oh-my-zsh后导致的卡顿问题
- Jquery:小知识;
- iOS开发——UI基础-屏幕适配
- jquery实现的个性网站首页 详细信息
- window注册表
- Python练习_更改配置文件(3)
- POJ 1562(L - 暴力求解、DFS)
- 使用JAVASCRIPT实现静态物体、静态方法和静态属性
- DNS解析详细过程
- 通过分析 JDK 源代码研究 TreeMap 红黑树算法实
- Ubuntu16.04 Using Note
- 解决Python2.7的UnicodeEncodeError:'ascii' codec can't encode characters in position 0-78: ordinal not in range(128)异常错误
- Visual Studio的一些快捷键
- Ehcache 3.7文档—基础篇—GettingStarted
- [TJOI2018]教科书般的亵渎
- JavaScript——执行环境、变量对象、作用域链
- opencv中imread第二个参数的意义
- (转)Android分布式编译学习(一)distcc实现分布式编译 —— Ubuntu12.04上部署distcc分布式编译
- Spring Boot集成Quartz注入Spring管理的类