Advertisement
Guest User

Untitled

a guest
Jun 19th, 2019
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.95 KB | None | 0 0
  1. @IBOutlet weak var progressView: UIView!
  2. @IBOutlet weak var questionCounter: UILabel!
  3. @IBOutlet weak var scrollView: UIScrollView!
  4. @IBOutlet weak var questionNumber: UILabel!
  5. @IBOutlet weak var questionTitle: UILabel!
  6. @IBOutlet weak var questionText: UILabel!
  7. @IBOutlet weak var optionA: UIButton!
  8. @IBOutlet weak var optionB: UIButton!
  9. @IBOutlet weak var optionC: UIButton!
  10. @IBOutlet weak var optionD: UIButton!
  11. @IBOutlet weak var optionE: UIButton!
  12.  
  13. //Below is for parsed json data version
  14. var allQuestions = [Questions]()
  15. var questionNumbers: Int = 0
  16. var AnswerQuestions: Int = 0
  17. var selectedAnswer: Int = 0
  18.  
  19. func updateUI() {
  20.  
  21. self.questionNumber.text = String(surveyQuestions?.questions[questionNumbers].questionNumber ?? 0)
  22.  
  23. self.questionTitle.text = surveyQuestions?.questions[questionNumbers].category.name
  24.  
  25. self.questionText.text = surveyQuestions?.questions[questionNumbers].text
  26.  
  27. self.questionText.text = surveyQuestions?.questions[questionNumbers].text.replacingOccurrences(of: "<[^>]+>", with: "", options: .regularExpression, range: nil)
  28.  
  29.  
  30. optionA.setTitle(surveyQuestions?.questions[questionNumbers].answerChoices[AnswerQuestions].text, for: UIControl.State.normal)
  31. optionB.setTitle(surveyQuestions?.questions[questionNumbers].answerChoices[AnswerQuestions].text, for: UIControl.State.normal)
  32. optionC.setTitle(surveyQuestions?.questions[questionNumbers].answerChoices[AnswerQuestions].text, for: UIControl.State.normal)
  33. optionD.setTitle(surveyQuestions?.questions[questionNumbers].answerChoices[AnswerQuestions].text, for: UIControl.State.normal)
  34. optionE.setTitle(surveyQuestions?.questions[questionNumbers].answerChoices[AnswerQuestions].text, for: UIControl.State.normal)
  35.  
  36. print("Success")
  37.  
  38. }
  39.  
  40. for button in question {
  41. button.setTitle(question?.questions[number].text, for: UIControl.State.normal)
  42. }
  43.  
  44. for i in 0...<button.count {
  45. button.setTitle(question?.questions[number].text, for: UIControl.State.normal)
  46. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement