// 重写此方法将按钮的点击范围扩大 - (BOOL)pointInside:(CGPoint)point withEvent:(UIEvent *)event { CGRect bounds = self.bounds; // 扩大点击区域 bounds = CGRectInset(bounds, -20, -20); // 若点击的点在新的bounds里面。就返回yes return CGRectContainsPoint(bounds, point); }
// 重写此方法将按钮的点击范围扩大 - (BOOL)pointInside:(CGPoint)point withEvent:(UIEvent *)event { CGRect bounds = self.bounds; // 扩大点击区域 bounds = CGRectInset(bounds, -20, -20); // 若点击的点在新的bounds里面。就返回yes return CGRectContainsPoint(bounds, point); }
转载于:https://www.cnblogs.com/pengsi/p/8434759.html