TouchUpInside on UIView with children

iphone, touch-up-inside, uiview-hierarchy

Solution

You can change the UIView's class in the Identity Inspector ... make it `UIControl` and then you can add an event for `UITouchUpInside` for your view - to catch the taps on it.

Good luck!

EDIT: here's a step-by-step with screenshots:

The view...

... of course, no events.

Go back and change UIView with UIControl and...

Ta-daa! Events!

Hook a method to the UITouchUpInside event

This is how it should look like in the interface file

This is how it should look like in the implementation file (you can, of course, replace the logging with anything you want)

Problem

I may be missing something here, but... I have a `UIView` with a few children (a couple of `UILabel`'s and `UIImageView`). I need to catch an event when the user clicks (taps) anywhere within the parent `UIView` - visible part of the `UIView` or any of its children). What's the best way of doing this?

Original source