Post marked as solved
Post marked as solved with 2 replies, 438 views
I have 3 UIButtons, and 3 different variables:
var firstSign: Sign?
var secondSign: Sign?
var thirdSign: Sign?
My goal is to set Title for each button with each variable in random order. I did it for first one and second one, but can't figure out how to add third title. The second one goes as title for Button 2 & 3. This is Quiz game app so first button is additionally marked as rightAnswer.
rightAnswerPlace = arc4random_uniform(3)+1
var button: UIButton = UIButton()
for i in 1...3 {
button = view.viewWithTag(i) as! UIButton
if (i == Int(rightAnswerPlace)) {
button.setTitle(firstSign!.name, for: .normal)
} else {
button.setTitle(secondSign!.name, for: .normal)
}
}
I know the code above is not completed, but I can't figure out how to add thirdSign variable into the for loop as third button title.