How can I detect touch events on a UIImageView inside a deep hierarchy of UIViews?
Posted
by jester
on Stack Overflow
See other posts from Stack Overflow
or by jester
Published on 2010-03-30T15:18:07Z
Indexed on
2010/03/30
17:33 UTC
Read the original article
Hit count: 714
I am developing a simple game on iPhone and I started with a View based application, and through the UIViewController I am loading a custom UIView that contains some more UIViews and some UIImageViews. I want to detect touch events on some of the UIImageViews, but I wasn't able so far.
I've created a second project for testing purposes and figured that UIImageViews handle touch events when the hierarchy is like : UIViewController -> UIView -> UIImageView, but when it's like : UIViewController -> UIView -> UIView -> UIImageView they are not detected.
Notes:
- userInteractionEnabled is YES in all cases
- all UIViews and UIImageViews I mention above are custom subclasses.
Can you think of any reason why, when a custom UIImageView gets deeper in the view hierarchy can't receive touch events?
© Stack Overflow or respective owner