Last active
February 2, 2018 08:54
-
-
Save simonpang/cdcf806420a7b49fc0f02f1d83fd6d84 to your computer and use it in GitHub Desktop.
Debug UIEvent
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
override func sendEvent(_ event: UIEvent) { | |
NSLog("sendEvent \(event)") | |
super.sendEvent(event) | |
var vc = keyWindow!.rootViewController! | |
while vc.presentedViewController != nil { | |
vc = vc.presentedViewController! | |
} | |
// Find hit view | |
if let view = vc.view { | |
if let t = event.allTouches?.first { | |
let p = t.location(in: view) | |
if let hitView = view.hitTest(p, with: event) { | |
NSLog("hit view = \(hitView)") | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Then debug view hierarchy in Xcode, filter view using the memory address of the hit view.