Skip to content

Instantly share code, notes, and snippets.

@heinrisch
Created August 10, 2015 11:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save heinrisch/39047e160335441c98fe to your computer and use it in GitHub Desktop.
Save heinrisch/39047e160335441c98fe to your computer and use it in GitHub Desktop.
Grow hit area
override func hitTest(point: CGPoint, withEvent event: UIEvent?) -> UIView? {
let errorMargin : CGFloat = 30;
let largerFrame = CGRectMake(0 - errorMargin, 0 - errorMargin, frame.size.width + 2*errorMargin, frame.size.height + 2*errorMargin);
return largerFrame.contains(point) ? self : nil
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment