Does anyone know how to turn a picture of some sort into a UIButton
?
Asked
Active
Viewed 76 times
-5
-
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 Answers
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) {
//
}

RHANIZAR Aymane
- 1
- 2
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