Skip to content

Instantly share code, notes, and snippets.

@malcommac
Created July 9, 2018 06:23
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 malcommac/8ef265d1cd7745e31e39557eaba3e6ee to your computer and use it in GitHub Desktop.
Save malcommac/8ef265d1cd7745e31e39557eaba3e6ee to your computer and use it in GitHub Desktop.
Extended UIButton Aread
import UIKit
@IBDesignable
class ExtendedUIButton: UIButton {
@IBInspectable var extendedMargin:CGFloat = 30.0
override func point(inside point: CGPoint, with event: UIEvent?) -> Bool {
let area = self.bounds.insetBy(dx: -extendedMargin, dy: -extendedMargin)
return area.contains(point)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment