When I press the BUTTON for the 1st time, the label displays "Who's is Arnold?"
When I press the BUTTON for the 2nd time I'd want "Who's is Kevin?" to be displayed on the label field, instead of "Who's is Arnold?"
When I press the button for the 3rd time I'd want "Who's is Liu?" to be displayed on the label field, instead of "Who's is Kevin?"
@IBAction func answerButtonTapped(send: UIButton){
var question = questionField.text
var i = 0
var listOfQuestions = ["Who is Arnold?", "Who is Kevin?", "Who is Liu?"]
for (i=0; i<=listOfQuestions.count; i++){
questionField.text = "(listOfQuestions[i])"
}
}
var counter = 0
var listOfQuestions = ["Who is Arnold?", "Who is Kevin?", "Who is Liu?"]
@IBAction func answerButtonTapped(send: UIButton){
questionField.text = listOfQuestions[counter%listOfQuestions.count]
counter++
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.