I have setup @iboutlets collection with many images but I want to change the images as a collection and use its tag to chose what image will change but I don't know correct code to change using the tag. I can change a label but get error on images this is how I change image but I need to do it using the image tag
@IBOutlet var Pics: [UIImageView]!
@IBAction func MyAction(_ sender: UIButton) {
Pics.image = (SandDFaults[Fault])
}
I have seen code like I need but this only works on text labels I want to change images here is something like I need
import UIKit
class ViewController: UIViewController {
var outputTagNumber = 0
override func viewDidLoad() {
super.viewDidLoad()
}
@IBOutlet var myLabels: [UILabel]!
@IBAction func myButton(_ sender: UIButton) {
outputTagNumber = (sender.tag+1)
let myLabels = view.viewWithTag(outputTagNumber) as! UILabel
myLabels.text = "Changed this one"
}
}
How can I do this with images? not text
hope this makes it more clear what I need thanks