I'm trying to assign an UIImageView
to an action when the user taps it.
I know how to create an action for a UIButton
, but how could I mimic the same behavior of a UIButton
, but using a UIImageView
?
iosswiftuiimageview
I'm trying to assign an UIImageView
to an action when the user taps it.
I know how to create an action for a UIButton
, but how could I mimic the same behavior of a UIButton
, but using a UIImageView
?
Best Answer
You'll need a
UITapGestureRecognizer
. To set up use this:(You could also use a
UIButton
and assign an image to it, without text and than simply connect anIBAction
)