UIView独占响应事件
2014-04-30 15:56
323 查看
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的时候你就知道了,上例子:
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(0, 0, 100, 100)]; [self.view addSubview:_button1]; _button1.backgroundColor = [UIColor redColor]; [_button1 addTarget:self action:@selector(buttonsEvent:) forControlEvents:UIControlEventTouchUpInside]; _button1.exclusiveTouch = YES; _button2 = [[UIButton alloc] initWithFrame:CGRectMake(0, 100, 100, 100)]; [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(@"1"); } if (_button2 == sender) { NSLog(@"2"); } } @end
相关文章推荐
- jsp中request.getParameter()中文乱码问题解决
- easyui tree使用方法
- ubuntu获取查看uuid的方法
- 惊涛怪浪(double dam-break) -- position based fluids
- Chap4: question: 19 - 28
- Android的uiAutomator
- Android build系统中常用LOCAL_变量
- 修复VirtualBox "This kernel requires the following features not present on the CPU: pae Unable to boot
- 安装fluentd时配置fluent-plugin-elasticsearch发生的错误
- 隐藏在背后的交互设计
- Access restriction: The type * is not accessible due to restrict
- windows phone导航到WIFI BlueTool Cellular AirplaneMode设置界面
- Request.Form的简单使用demo
- 数据库查询生成器控件集Active Query Builder免费下载功能详解
- 随心所欲导出你的 UI 界面到 PDF 文件
- UITableView.separatorInset
- Solr4.2 新特性 DocValues
- configure.ac:20: error: Autoconf version 2.65 or higher is required
- UISearchBar
- Android UI开发第四十一篇——墨迹天气3.0引导界面及动画实现