美文网首页
代码片段 超出父视图 事件点击

代码片段 超出父视图 事件点击

作者: 梓华 | 来源:发表于2019-12-31 14:12 被阅读0次

    参考
    https://www.jianshu.com/p/5e86f900b3cc

    - (UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event;
    
    - (UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event
    {
        UIView *view = [super hitTest:point withEvent:event];
        
        CGPoint tempPoint = [self.editBtn convertPoint:point fromView:self];
        
        if([self.editBtn pointInside:tempPoint withEvent:event])
        {
            return self.editBtn;
        }
        
        return view;
    }
    
    - (BOOL)pointInside:(CGPoint)point withEvent:(UIEvent *)event;
    
    - (BOOL)pointInside:(CGPoint)point withEvent:(UIEvent *)event {
        return ([super pointInside:point withEvent:event]
                || CGRectContainsPoint(_tipView.frame, point)
                );
    }
    

    相关文章

      网友评论

          本文标题:代码片段 超出父视图 事件点击

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