iOS swift回到开头

时间:2016-02-24 17:30:09

标签: ios swift

当我按下按钮4次时,模拟器崩溃了。 我第四次按下按钮时,我想回到第一个问题。

let Questions = ["Who’s Louis?", "Who’s Mark?", "Who’s Paul?"]

@IBAction func answerButtonTapped(sender: AnyObject){

    var question = questionField.text

// display question
    questionField.text = listOfQuestions[currentQuestionIndex]

         if currentQuestionIndex <= listOfQuestions.count {
             ++currentQuestionIndex

             //discussQuestion(answer)

             answerBut.setTitle("ANSWER", forState:    UIControlState.Normal)

         } else {
             (sender as UIButton).userInteractionEnabled = false
         }
}

0 个答案:

没有答案