Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @IBOutlet weak var progressView: UIView!
- @IBOutlet weak var questionCounter: UILabel!
- @IBOutlet weak var scrollView: UIScrollView!
- @IBOutlet weak var questionNumber: UILabel!
- @IBOutlet weak var questionTitle: UILabel!
- @IBOutlet weak var questionText: UILabel!
- @IBOutlet weak var optionA: UIButton!
- @IBOutlet weak var optionB: UIButton!
- @IBOutlet weak var optionC: UIButton!
- @IBOutlet weak var optionD: UIButton!
- @IBOutlet weak var optionE: UIButton!
- //Below is for parsed json data version
- var allQuestions = [Questions]()
- var questionNumbers: Int = 0
- var AnswerQuestions: Int = 0
- var selectedAnswer: Int = 0
- func updateUI() {
- self.questionNumber.text = String(surveyQuestions?.questions[questionNumbers].questionNumber ?? 0)
- self.questionTitle.text = surveyQuestions?.questions[questionNumbers].category.name
- self.questionText.text = surveyQuestions?.questions[questionNumbers].text
- self.questionText.text = surveyQuestions?.questions[questionNumbers].text.replacingOccurrences(of: "<[^>]+>", with: "", options: .regularExpression, range: nil)
- optionA.setTitle(surveyQuestions?.questions[questionNumbers].answerChoices[AnswerQuestions].text, for: UIControl.State.normal)
- optionB.setTitle(surveyQuestions?.questions[questionNumbers].answerChoices[AnswerQuestions].text, for: UIControl.State.normal)
- optionC.setTitle(surveyQuestions?.questions[questionNumbers].answerChoices[AnswerQuestions].text, for: UIControl.State.normal)
- optionD.setTitle(surveyQuestions?.questions[questionNumbers].answerChoices[AnswerQuestions].text, for: UIControl.State.normal)
- optionE.setTitle(surveyQuestions?.questions[questionNumbers].answerChoices[AnswerQuestions].text, for: UIControl.State.normal)
- print("Success")
- }
- for button in question {
- button.setTitle(question?.questions[number].text, for: UIControl.State.normal)
- }
- for i in 0...<button.count {
- button.setTitle(question?.questions[number].text, for: UIControl.State.normal)
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement