Is there an way to make an invisible UIButton that will still “be there” and catch touch events for my UIImageView?

后端 未结 11 2070
悲哀的现实
悲哀的现实 2020-12-25 11:41

I thought to be clever and just put an transparent UIButton over an UIImageView with the exact frame size, so that I can wire it up easily with any event I like, for example

11条回答
  •  渐次进展
    2020-12-25 12:15

    i also beleive you can assign an image to a button.

    The image can take up the entire frame and can also have no other artifacts of the buttone if you set it up right.

    check out the Property

    UIButtonInstance.currentImage
    

    That way you are not hogging your resources with elements that are essentially already there.

提交回复
热议问题