Last Updated: May 11, 2020
·
1.012K
· nvln

Enlarge tappable UIView area

Super useful when your tappable object is less than the golden 44 points. Taken from WWDC2012 Session 216.

- (BOOL)pointInside:(CGPoint)point withEvent:(UIEvent *)event
    {
    CGFloat widthDelta = 44.0 - bounds.size.width;
    CGFloat heightDelta = 44.0 - bounds.size.height;
    CGRect bounds = CGRectInset(self.bounds, -0.5 * widthDelta, -0.5 * heightDelta);
    return CGRectContainsPoint(bounds, point);
}