Skip to content

Instantly share code, notes, and snippets.

@dejanskledar
Created October 16, 2017 13:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save dejanskledar/fb2b737d1b3a9afd94df8fb95a0c0589 to your computer and use it in GitHub Desktop.
Save dejanskledar/fb2b737d1b3a9afd94df8fb95a0c0589 to your computer and use it in GitHub Desktop.
override func hitTest(_ point: CGPoint, with event: UIEvent?) -> UIView? {
let from = point
let to = middleButton.center
return sqrt((from.x - to.x) * (from.x - to.x) + (from.y - to.y) * (from.y - to.y)) <= 35 ? middleButton : super.hitTest(point, with: event)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment