2022-02-07 iOS 扩大view 点击区域

- (BOOL)pointInside:(CGPoint)pointwithEvent:(UIEvent*)event {

    CGRectbounds =self.bounds;

    //扩大原热区直径至30,可以暴露个接口,用来设置需要扩大的半径。

    CGFloatwidthDelta =30;

    CGFloatheightDelta =30;

    bounds =CGRectInset(bounds, -0.5* widthDelta, -0.5* heightDelta);

    returnCGRectContainsPoint(bounds, point);

}

你可能感兴趣的:(2022-02-07 iOS 扩大view 点击区域)