响应者链

2016-10-27  本文已影响9人  Hyman0819

一、查找控件

UIApplication -> UIWindow -> UIViewController ->UIView ->AVView

二、响应事件(反过来)

AVView ->UIView -> UIViewController -> UIWindow -> UIApplication

响应者链
/*
 *注释:
  1.自定义手势、
  2.隐藏键盘
 */

//触摸开始
-(void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event
{
    NSLog(@"触摸开始");
    
    UITouch *touch = [touches anyObject];
    
    CGPoint point = [touch locationInView:self.view];
}
//触摸结束
-(void)touchesEnded:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event
{
    NSLog(@"触摸结束");
}

//触摸移动
-(void)touchesMoved:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event
{
    NSLog(@"触摸移动");
}
//触摸取消
-(void)touchesCancelled:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event
{
    NSLog(@"触摸取消");
}
上一篇下一篇

猜你喜欢

热点阅读