事件响应链
来源:互联网 发布:定做软件 猪八戒网 编辑:程序博客网 时间:2024/05/29 07:37
(1)设置根视图控制器
(2)RootViewController.m
- (void)viewDidLoad{ [super viewDidLoad]; MyView *view = [[MyView alloc] initWithFrame:CGRectMake(0, 20, 320, 300)]; view.backgroundColor = [UIColor grayColor]; [self.view addSubview:view]; }- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event { NSLog(@"viewCtrl touchesBegan"); [self.nextResponder touchesBegan:touches withEvent:event];}
(3)MyView.m
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event { NSLog(@"myView touchesBegan"); //将事件传递给下一个响应者 /* nextResponder可以取得下一个响应者 */ [self.nextResponder touchesBegan:touches withEvent:event];}
(4)TouchWindow.m
//window分发事件的方法- (void)sendEvent:(UIEvent *)event { NSLog(@"window sendEvent"); [super sendEvent:event]; }- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event { NSLog(@"window touchesBegan"); }
0 0
- 事件响应链
- 事件响应链
- iOS事件响应链
- 【iOS】事件响应链
- 事件响应者链
- 触摸事件<响应者链>
- ios-事件响应者链
- UI基础:事件.响应链
- 触摸、事件、响应者链
- 事件分发和响应链
- oc-事件传递响应链
- 事件分发 响应者链
- iOS 事件响应链原理
- iOS事件传递和事件响应链
- 事件响应
- 事件响应
- 关于检查链和事件响应链
- Touch 与旋转 事件链 响应
- 目录取消svn版本控制
- php 获得某个目录下所有的文件名
- Remove Nth Node From End of List,Longest Common Prefix,Palindrome Number,Roman to Integer
- 数据结构--堆
- makefile模板
- 事件响应链
- 使用Amoeba for mysql实现mysql读写分离
- 基于HTML5的网络拓扑图
- 数组Fibonacci Microsoft Visual Studio 运行 C语言写
- Java mina TcpCommunicationHandler extends IoHandlerAdapter
- 函数返回值类型
- 你不懂之--驻极体麦克风简介
- Redis源码分析(十九)——二进制位操作bitops
- 让apache虚拟目录外网可以访问