@IBAction Function buttonPressed / tags not responsive
@IBAction Function buttonPressed / tags not responsive
I am trying to have a multiple choice test format — however when I try to trigger buttonPressed function using tagged buttons, my question & answer text is not updated... any advice?
questionIndex = 1
@IBAction func buttonPressed(_ sender: UIButton) {
if sender.tag == 1 || sender.tag == 2 || sender.tag == 3 || sender.tag == 4 && questionIndex == 1 {
questionButton.text = q2
answer1.setTitle(a2a, for: .normal)
answer2.setTitle(a2b, for: .normal)
answer3.setTitle(a2c, for: .normal)
answer4.setTitle(a2d, for: .normal)
questionIndex = 2
}
The first question & answers appear correctly, but never update after pressing an answer. Answer buttons have tags 1, 2, 3, & 4.
UPDATE: I dragged the buttons into the function to assure connection, and now it proceeds to the next question, but then it doesn't continue to the next.
By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.