美文网首页
响应者链

响应者链

作者: Hyman0819 | 来源:发表于2016-10-27 10:19 被阅读9次

    一、查找控件

    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(@"触摸取消");
    }
    

    相关文章

      网友评论

          本文标题:响应者链

          本文链接:https://www.haomeiwen.com/subject/deijuttx.html