iOS扩大按钮UIButton的点击范围

- (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);//注意这里是负数,扩大了之前的bounds的范围

returnCGRectContainsPoint(bounds, point);

}


你可能感兴趣的:(iOS)