UIImageView as button

后端 未结 5 1152
庸人自扰
庸人自扰 2020-12-12 17:48

I\'m trying to make a UIImageView accept actions and fire them everytime it clicked on the UIImageVie, but i\'m having hard time in getting it to work, please help me out

5条回答
  •  没有蜡笔的小新
    2020-12-12 18:07

    All you have to do is drag a Tap Gesture Recognizer onto the imageView (in Storyboard) and enable User Interaction on the Attributes Inspector. If you want to use the image as a link to another view controller, just control-drag the Tap Gesture Recognizer icon in the bottom of the view controller to the destination view controller.

提交回复
热议问题