-5

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

rmaddy
  • 307,833
  • 40
  • 508
  • 550
ReeRay
  • 1
  • 1
  • 3
  • 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
  • 37,198
  • 7
  • 99
  • 103
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,293
  • 1
  • 19
  • 27