Advertisement
thurtek

Untitled

Jan 17th, 2018
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Swift 1.12 KB | None | 0 0
  1. //
  2. //  quiz.swift
  3. //  BackJoy
  4. //
  5. //  Created by arthur josselin on 15/01/2018.
  6. //  Copyright © 2018 BackJoy. All rights reserved.
  7. //
  8.  
  9. import UIKit
  10.  
  11. class quiz: UIView {
  12.  
  13.     //good response
  14.     var response = 0
  15.    
  16.     //Label and textview Outlet
  17.     @IBOutlet weak var label: UILabel!
  18.     @IBOutlet weak var question: UITextView!
  19.    
  20.     //Button Outlet
  21.     @IBOutlet weak var b1: UIButton!
  22.     @IBOutlet weak var b2: UIButton!
  23.    
  24.    
  25.     @IBAction func action1(_ sender: Any) {
  26.         if response == 1{
  27.             label.text = "Bonne réponse !"
  28.             label.textColor = UIColor(red: 0.2, green: 0.8, blue: 0.2, alpha: 1)
  29.         }
  30.         else{
  31.             label.text = "Mauvaise réponse !"
  32.             label.textColor = UIColor.red
  33.         }
  34.     }
  35.    
  36.     @IBAction func action2(_ sender: Any) {
  37.         if response == 2{
  38.             label.text = "Bonne réponse !"
  39.             label.textColor = UIColor(red: 0.2, green: 0.8, blue: 0.2,alpha: 1)
  40.         }
  41.         else{
  42.             label.text = "Mauvaise réponse !"
  43.             label.textColor = UIColor.red
  44.         }
  45.     }
  46.  
  47. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement