exclusiveTouch

A Boolean value that indicates whether the receiver handles touch events exclusively.
Setting this property to YES causes the receiver to block the delivery of touch events to other views in the same window. The default value of this property is NO.

一个布尔值,用来标示一个view独占触摸事件.

当把一个view中的exclusiveTouch设置成YES时,会致使这个window屏蔽掉其他的view触发响应事件.默认值是NO.

不用说就知道他的用处了,你不知道怎么回事么?以后你会懂的,测试人员给你提bug的时候你就知道了,上例子:

#import "RootViewController.h"

@interface RootViewController ()

@property (nonatomic, strong) UIButton   *button1;
@property (nonatomic, strong) UIButton *button2; @end @implementation RootViewController - (void)viewDidLoad
{
[super viewDidLoad]; _button1 = [[UIButton alloc] initWithFrame:CGRectMake(, , , )];
[self.view addSubview:_button1];
_button1.backgroundColor = [UIColor redColor];
[_button1 addTarget:self
action:@selector(buttonsEvent:)
forControlEvents:UIControlEventTouchUpInside]; _button1.exclusiveTouch = YES; _button2 = [[UIButton alloc] initWithFrame:CGRectMake(, , , )];
[self.view addSubview:_button2];
_button2.backgroundColor = [UIColor greenColor];
[_button2 addTarget:self
action:@selector(buttonsEvent:)
forControlEvents:UIControlEventTouchUpInside]; _button2.exclusiveTouch = YES;
} - (void)buttonsEvent:(id)sender
{
if (_button1 == sender)
{
NSLog(@"");
} if (_button2 == sender)
{
NSLog(@"");
}
} @end

最新文章

  1. JavaScript开发原生App模式能否突出重围?
  2. Selenium2+python自动化11-定位一组元素find_elements
  3. 在桌面chrome中调试android设备中的web页面
  4. 转:Java学习路线图,专为新手定制的Java学习计划建议
  5. 基于XMPP的即时通信系统的建立(四)— 组件介绍
  6. Time.deltaTime 含义和应用
  7. sort()排序 collections.sort();
  8. bzoj3065: 带插入区间K小值
  9. 关于退运美国转基因玉米含有MRI 162转基因成分的质疑
  10. C# 超级简单的Telnet (TcpClient)客户端
  11. 侯捷STL学习(四)--allocator和容器时间的实现关系
  12. WEB 小案例 -- 网上书城(二)
  13. SSH架构实现在线支付功能
  14. 国内开源社区巨作AspectCore-Framework入门
  15. Effective Java --使类和成员的可访问性最小化
  16. Win10恢复账户默认半透明头像
  17. Mac osx 启用和关闭root用户
  18. 对Property进行RACObserve
  19. Docker Dockerfile 基本结构详解
  20. 我在JS上解惑之路1

热门文章

  1. Validate Binary Search Tree——体现二查搜索树思想的一道题
  2. 写在Web考试后的一点小总结
  3. python快速教程-vamei
  4. openCV训练程序申请内存不足
  5. 使用注解配置SQL映射器
  6. 记录自己在 cmd 中执行 jar 文件遇到的一些错误
  7. vars 变量预解析
  8. ref:ubuntu下如何批量修改文件后缀名
  9. 转:perl源码审计
  10. 初识 Fuzzing 工具 WinAFL