How to use buttons to change pictures in the UIImageView that are in my assets?
Can you explain precisely what you want ? The title is not made to formulate the full question.
Do you know how to set imageView ?
In the button IBAction, just add the following
myimageView.image = UIImage(named: "SomeImage")
Use Tag Value To Change your image View, Based On Tag U Can image View images without any another variable. I only told to change only
3 images in between them if u want more than u have to maintain tags.
@IBOutlet func changeImageBtnTouchUpInside(_ sender:UIButton){
if(sender.tag == 0){
myimageView.image = UIImage(named: "firstImage")
sender.tag = 1
}else if(sender.tag == 1){
myimageView.image = UIImage(named: "secondImage")
sender.tag = 2
}else if(sender.tag == 2){
myimageView.image = UIImage(named: "thirdImage")
sender.tag = 0
}
}