Skip to content

Instantly share code, notes, and snippets.

@strzempa
Created October 11, 2019 05:30
Show Gist options
  • Save strzempa/4215032a63c9382c49b995eed6f658c4 to your computer and use it in GitHub Desktop.
Save strzempa/4215032a63c9382c49b995eed6f658c4 to your computer and use it in GitHub Desktop.
import UIKit
@IBDesignable
class UIExpandedTouchAreaButton: UIButton {
@IBInspectable var margin: CGFloat = 40.0
override func point(inside point: CGPoint, with event: UIEvent?) -> Bool {
let area = self.bounds.insetBy(dx: -margin, dy: -margin)
return area.contains(point)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment