Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iOS - debugging tool to detect view touched

Wondering if anyone has written or come across a good way to log to the console the view that a touch occurred in. I know touchesEnded: can be implemented, but my problem is that something mysterious is blocking touches on my views and I don't know what it is. I would just like to know what is intercepting the touches.

I would like to log to the console:

"Touch occurred in view: nameOfSomeUIView"

like image 676
sol Avatar asked Sep 02 '10 17:09

sol


1 Answers

Each UITouch object has a view property described as "The view in which the touch initially occurred." You can subclass UIWindow and override the sendEvent method. In your implementation of sendEvent you can call [super sendEvent: event] and after that inspect the view properties of all the touches that belong to the event.

As a general tip: Check the hitTest method of your views if your UITouches do not behave as expected. You can override this method to see which view should receive touches.

like image 72
Felix Avatar answered Sep 28 '22 10:09

Felix