UIView独占响应事件
2023-09-14 08:57:58 时间
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; @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];
页面运行中事件频繁触发会阻塞页面吗? 之前看`防抖`和`节流`的时候,看到短时间内大量的事件触发会引起浏览器卡死,浪费浏览器性能,那么为什么事件触发会引起阻塞页面的情况呢?引起页面阻塞的原因真的是因为事件触发太多了吗?
非UI线程下页面处理:view的postInvalidate和post对消息处理的差异化 我们知道view有一系列post方法,用于在非UI线程中发出一些页面处理。view还有另外一个postInvalidate方法,同样在非UI线程中发起重绘。 同样是在非UI线程向UI线程发出消息,但是这里面有很大的区别。
相关文章
- 使用EventLog类写Windows事件日志
- 在手势中屏蔽响应事件继续向父视图传递
- ThinkPHP6 事件与多应用
- 关于IE浏览器以及Firefox下冒泡事件的响应层级
- js 触发长按事件
- select标签的onchange事件
- 【IOS-COCOS2D-X 游戏开发之十五】COCOS2DX中响应ANDROID的BACK(返回)与MENU(小房子)事件&&COCOS2DX自动释放粒子内存函数!
- ExtJs之DHTML,DOM,EXTJS的事件绑定区别
- MFC Windows 程序设计[186]之对话框控件响应事件(附源码)
- reactjs onClick绑定点击事件的正确写法
- Win7下的DragEnter、DragDrop事件不触发的解决方案
- SAP Spartacus B2B ListComponent响应回车事件的实现
- 微信小程序开发系列 (三) :微信小程序如何响应用户点击事件和微信平台 API 的使用方法介绍
- 两种使用JavaScript触发ABAP事件的技术手段
- Angular list列表的事件响应实现
- Python之tkinter:动态演示调用python库的tkinter带你进入GUI世界(text.insert/link各种事件)
- 从源码分析DEARGUI之键盘鼠标事件监控
- [CocosCreator]-02-设备重力传感事件
- python web py入门(46)- jQuery 事件 - $( document ).ready与$( window ).on( "load"的区别
- python web py入门(68)- jQuery - 按钮事件的响应顺序
- wpf button的mouse(leftbutton)down/up,click事件不响应解决办法
- 对于移动端浏览器touch事件的研究总结(4)判断手指滑动方向
- 如何在 Kitten 里绘制两个相邻的正方体并响应用户输入事件
- 2023年中职网络安全技能竞赛网络安全事件响应解析(保姆级)