Spanky
Spanky

Reputation: 5000

Touch events aren't reaching touches methods?

I have a View Controller, and a UIImageView as a subview. That UIImageView also has a subview of that same type.

I have:

self.userInteractionEnabled = YES;

set for each. My touchesEnded code was working. Any idea what would cause this? No touches are even reaching the touches events. I don't understand?

Any help appreciated.

Thanks // :)

Upvotes: 1

Views: 811

Answers (2)

Spanky
Spanky

Reputation: 5000

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!

Upvotes: 0

mahboudz
mahboudz

Reputation: 39376

Sounds like you've gone all the way up the chain and checked the self.userInteractionEnabled all the way up to the top, right? Ok, now check if any view has exclusiveTouch set to YES.

Also, if you called resignFirstResponder on the parent view, instead of a UIText field, you would relinquish events.

Lastly, beginIgnoringInteractionEvents, can cause this too.

Upvotes: 1

Related Questions