2

I'm currently trying to create a simple UIView which contains some labels and images. How can I set the UIView as clickable?

I have already tried to override the onTouchEnded method, but when I added the labels and the images as sub-views to the view, the method is no longer called.

Scott
  • 21,211
  • 8
  • 65
  • 72
dimka87il
  • 95
  • 6

1 Answers1

2

but when I added the labels and the images as subviews to the view the method is not called anymore.

Because UIImageView and UILabel have their userInteractionEnabled property set to NO by default. Set it to YES (true) and that should be fine.

  • thanks it worked.. another solution that worked for me was to override the draw function in the UIView and draw the labels and images manually. but i think that your solution is much better – dimka87il Sep 08 '12 at 19:38