让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
让UIButton在按下时没有高亮效果的更多相关文章
- UIButton 之 按下高亮
设置高亮 [btn setHighlighted:YES]; 设置按下时高亮 [btn setShowsTouchWhenHighlighted:YES];
- UI-切圆角、透明度、取消按钮点击高亮效果、按钮文字带下划线
一.切UIView的某个角为圆角 如果需要将UIView的4个角全部都为圆角,做法相当简单,只需设置其Layer的cornerRadius属性即可(项目需要使用QuartzCore框架).而若要指定某 ...
- UITableView或UIScrollVIew上的UIButton的高亮效果
UITableView或UIScrollVIew上的UIButton的高亮效果 原文地址:http://www.jianshu.com/p/b4331f06bd34 最近做项目的时候发现,UIScro ...
- 动画的button(按下时缩小,松开时恢复)
#import <UIKit/UIKit.h> @interface AppDelegate : UIResponder <UIApplicationDelegate> @pr ...
- 发布.net 4.0的站点到IIS7.5下时无法访问
现象: 初始发布.net 4.0站点到IIS7.5下时,各种配置都完毕的情况下依旧无法访问.首页显示站点目录结构(注:开启目录结构访问后会显示这个错误,否则会提示开启),访问次级目录提示:Handle ...
- #748 – 获得按下时对应位置点的大小(Getting the Size of a Contact Point during Raw Touch)
原文:#748 – 获得按下时对应位置点的大小(Getting the Size of a Contact Point during Raw Touch) 原文地址:https://wpf.2000t ...
- keydown([[data],fn]) 当键盘或按钮被按下时,发生 keydown 事件。
keydown([[data],fn]) 概述 当键盘或按钮被按下时,发生 keydown 事件. 注释:如果在文档元素上进行设置,则无论元素是否获得焦点,该事件都会发生.直线电机滑台 参数 fnFu ...
- MouseMoveEvent为了不太耗资源在默认状态下是要鼠标按下才能捕捉到。要想鼠标不按下时的移动也能捕捉到,需要setMouseTracking(true)
最近用Qt软件界面,需要用到mouseMoveEvent,研究了下,发现些问题,分享一下. 在Qt中要捕捉鼠标移动事件需要重写MouseMoveEvent,但是MouseMoveEvent为了不太耗资 ...
- myecplise上将工程部署到应用下时,经常出现 An internal error occurred during: "Add Deployment". java.lang.NullPointEx
myecplise上将工程部署到应用下时,经常出现 An internal error occurred during: "Add Deployment". java.lang.N ...
随机推荐
- 在 ASP.NET Web API 中,使用 命名空间(namespace) 来作为路由的参数
这个问题来源于我想在 Web API 中使用相同的控制器名称(Controller)在不同的命名空间下,但是 Web API 的默认 路由(Route) 机制是会忽略命名空间的不同的,如果这样做,会看 ...
- WPF控件TreeView使用
需要多级嵌套要用TreeViewItem,而这个在大纲视图右键控件可以点出来. 代码控制嵌套Items就可以. 如果显示"(集合)",检查嵌套的是不是TreeViewItem的It ...
- 新手MySQL工程师必备命令速查手册
MySQL的基本操作可以包括两个方面:MySQL常用语句如高频率使用的增删改查(CRUD)语句和MySQL高级功能,如存储过程.触发器.事务处理等.而这两个方面又可以细分如下: 1.MySQL常用语句 ...
- ubantu下安装软件
Linux系统中,软件通常以源代码或者预编译包的形式提供.(1)软件源代码需要编译为二进制的机器代码才能够使用,安装比较耗时,不过您可以自行调节编译选项,决定需要的功能或组件,或者针对硬件平台作一些优 ...
- Eclipse中Editor开启Auto-completion
Java Editor .abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ Java Script Editor 现在Eclipse限制使用最多 ...
- LeetCode: Add Binary 解题报告
Add BinaryGiven two binary strings, return their sum (also a binary string). For example,a = "1 ...
- c++构造函数中调用构造函数---匿名对象再探
#include<iostream> #include<string> using namespace std; class Copy_construction { publi ...
- MySQL 日期计算
MySQL提供了几个函数,可以用来计算日期,常用的例子就是,计算年龄或提取日期部分. 1. 计算年龄: mysql中要想计算一个人的年龄,相当于当前日期的年和出生日期之间的差.如果当前日期的日历年比出 ...
- ativemq使用教程
本文转自http://www.cnblogs.com/zhuxiaojie/p/5564187.html 目录: 一:JMQ的两种消息模式 1.1:点对点的消息模式 1.2:订阅模式 二:点对点的实 ...
- java原生序列化和Kryo序列化性能比较
简介 最近几年,各种新的高效序列化方式层出不穷,不断刷新序列化性能的上限,最典型的包括: 专门针对Java语言的:Kryo,FST等等 跨语言的:Protostuff,ProtoBuf,Thrift, ...