views:

746

answers:

3

I have added a subclass of UIView as a subview to an MKMapView when a button is pressed. The UIView has its background colour set to be clear. This UIView is not getting messaged with any of the touchesBegan, etc. messages. The MKMapView seems to be receiving all the messages still as zooming still occurs on a double click, etc.

How can I ensure that the subview is receiving the messages and is there a way to debug the responder chain, to see where the message is being sent.

Thanks.

If you need anymore information just say.

A: 

Have you made your UIView opaque? Because if it is, and you made it transparent then the touches will be taken up by the view underneath

Daniel
+1  A: 

Thanks for the reply. I have been able to fix the problem now. The issue was that I was adding the subview to the MKMapView rather than the view of the ViewController. I don't know why this is an issue. If you do I would be interested to hear. Adding the view as a subview to the view of the ViewController fixed everything, with the view now accepting the touches, even when its colour is UIColor clearColor.

You just solved my problem! I had a view controller with a subview UIImageView and a subview fo that which was another UIImageView. I had it all working, touches at the child level, then it just stopped? I went back to the first subview of the VC level and they work there. Adapting! Moved my code up and worked within that parent instead. Works!Thanks // :)
Spanky
A: 

I just found this solution from saimhann2002 who was having a similar problem.

Thanks for the reply. I have been able to fix the problem now. The issue was that I was adding the subview to the MKMapView rather than the view of the ViewController. I don't know why this is an issue. If you do I would be interested to hear. Adding the view as a subview to the view of the ViewController fixed everything, with the view now accepting the touches, even when its colour is UIColor clearColor.

That works!

Spanky