Skip to content

Instantly share code, notes, and snippets.

@youngshook
Created January 18, 2015 13:04
Show Gist options
  • Save youngshook/df3188904b35d1dc24d6 to your computer and use it in GitHub Desktop.
Save youngshook/df3188904b35d1dc24d6 to your computer and use it in GitHub Desktop.
放大UIButton点击热区
- (BOOL)pointInside:(CGPoint)point withEvent:(UIEvent*)event
{
    CGRect bounds = self.bounds;
    //若原热区小于44x44,则放大热区,否则保持原大小不变
CGFloat widthDelta = MAX(44.0 - bounds.size.width, 0);
CGFloat heightDelta = MAX(44.0 - bounds.size.height, 0);
bounds = CGRectInset(bounds, -0.5 * widthDelta, -0.5 * heightDelta);
return CGRectContainsPoint(bounds, point);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment