重写一个简单按钮,扩大可点击范围

#import "JHmoreBtn.h"

@implementation JHmoreBtn

- (instancetype)initWithFrame:(CGRect)frame

{

    self= [superinitWithFrame:frame];

    if(self) {



    }

    return self;

}

//修改点击范围

-(BOOL)pointInside:(CGPoint)point withEvent:(UIEvent*)event{


    CGRectbounds =self.bounds;

    CGFloatwidthDelta =44.0- bounds.size.width;

    CGFloatheightDelta =44.0- bounds.size.height;

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

    returnCGRectContainsPoint(bounds, point);



}

@end

你可能感兴趣的:(重写一个简单按钮,扩大可点击范围)