I have done the following to assign an UIImage to different instance of UIView object. Inside my UIView, I have an UIImageView which holds the Image.
var transitionImageNames = ["1.png", "2.png", "3.png", "4.png"]
var count=0
for item in myList {
var transitionImageName = transitionImageNames[count]
item.transitionImageView.image = UIImage(named: transitionImageName)
// transitionImageName refers to 4 different images, let say 1,2,3,4.png
if (count<=3) {
count += 1
}
}
there are a number of different items in myList. I have printed out the item instance, all of them have different instance value. However, I found that for the transitionImageView to be displayed, even if I set 1, 2, 3, 4.png to 4 different items in the myList, they all display the same image (which is the last one set)
Any idea on why?