响应者链

一、查找控件

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

二、响应事件(反过来)

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

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

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

//触摸移动
-(void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event
{
    NSLog(@"触摸移动");
}
//触摸取消
-(void)touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event
{
    NSLog(@"触摸取消");
}

你可能感兴趣的:(响应者链)