-5

Does anyone know how to turn a picture of some sort into a UIButton?

rmaddy
  • 314,917
  • 42
  • 532
  • 579
ReeRay
  • 1
  • 1
  • 4
  • Possible duplicate of [How to change UIButton image in Swift](http://stackoverflow.com/questions/26837371/how-to-change-uibutton-image-in-swift) – Uranus Oct 05 '16 at 20:26

3 Answers3

1

Programmatically:

let image = UIImage(named: "image")
btn.setImage(btnImage , forState: .normal)

Storyboard:
Select your image > Attributes inspector > Image

Rashwan L
  • 38,237
  • 7
  • 103
  • 107
0

You can do this properly by adding a tap gesture recognizer to your UIImageView and linked the gesture to an action

@IBAction func actionImageTapped(_ sender: UITapGestureRecognizer) {
    //
}
0

You can add TapGestureRecognizer in your UIImageView. That way you can add some event on touch event like button.

A K M Saleh Sultan
  • 2,403
  • 2
  • 22
  • 28