I can\'t figure out why tapping on text fields and buttons in my view is not working. I\'ve checked all the obvious things like whether userInteractionEnabled is set to YES, whe
A basic way to see what is consuming the touch events is to simply add a debug view and override the hitTest(:event:)
method. Attach this class to any to the view in the storyboard.
class DebugView: UIView {
override func hitTest(_ point: CGPoint, with event: UIEvent?) -> UIView? {
let view = super.hitTest(point, with: event)
print("View")
print(view)
return view
}
}
Attaching this to the root view of the controller will give you access to the view that is consuming the touch event. Note that the hitTest method will be called twice with every touch event.