In my .m file I added:
@property (strong, nonatomic) UIImageView *star1;
Then in a method I did:
UIImage *star1Image;
star1
So, since components like UILabel
or UIImageView
aren't design to be "touchable", to add a "touchable" feature (like a UITapRecognizer
), you have to set their userInteractionEnabled
to YES
.
So, even if you set this property correctly for your UIImageView
(star1
), since you add it as a subview of ratingLabelBody
, you couldn't trigger your UITapGestureRecognizer
(imgTouchUp:
).
You have to do the same to the parent view of your star1
, which is ratingLabelBody
.
Translated with code, you just had to do:
[ratingLabelBody setUserInteractionEnabled:YES];