I am making an iOS application with Swift 2. I have set 10 buttons tags' from 1-10. I am creating a loop for which var i loops through all numbers 1-10. A button I created is set to that tag. I am trying to set that button's image to nil. Here is my code:
var button : UIButton
for var i = 1; i <= 10; i++ {
print(i)
button = view.viewWithTag(i) as! UIButton
button.setImage(nil, forState: .Normal)
}
What am I doing wrong? I have set 10 buttons tags'