Skip to content

Instantly share code, notes, and snippets.

@simsaens
Created February 15, 2019 08:42
Show Gist options
  • Save simsaens/7c5a0c9b92a65b0961c0283e8eb4faf8 to your computer and use it in GitHub Desktop.
Save simsaens/7c5a0c9b92a65b0961c0283e8eb4faf8 to your computer and use it in GitHub Desktop.
Add these two overrides to class Header
override func point(inside point: CGPoint, with event: UIEvent?) -> Bool {
guard let menu = menuView else {
return super.point(inside: point, with: event)
}
let menuPoint = convert(point, to: menu)
if menu.point(inside: menuPoint, with: event) {
return true
}
return super.point(inside: point, with: event)
}
override func hitTest(_ point: CGPoint, with event: UIEvent?) -> UIView? {
guard let menu = menuView else {
return super.hitTest(point, with: event)
}
let menuPoint = convert(point, to: menu)
if let view = menu.hitTest(menuPoint, with: event) {
return view
}
return super.hitTest(point, with: event)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment