Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //
- // quiz.swift
- // BackJoy
- //
- // Created by arthur josselin on 15/01/2018.
- // Copyright © 2018 BackJoy. All rights reserved.
- //
- import UIKit
- class quiz: UIView {
- //good response
- var response = 0
- //Label and textview Outlet
- @IBOutlet weak var label: UILabel!
- @IBOutlet weak var question: UITextView!
- //Button Outlet
- @IBOutlet weak var b1: UIButton!
- @IBOutlet weak var b2: UIButton!
- @IBAction func action1(_ sender: Any) {
- if response == 1{
- label.text = "Bonne réponse !"
- label.textColor = UIColor(red: 0.2, green: 0.8, blue: 0.2, alpha: 1)
- }
- else{
- label.text = "Mauvaise réponse !"
- label.textColor = UIColor.red
- }
- }
- @IBAction func action2(_ sender: Any) {
- if response == 2{
- label.text = "Bonne réponse !"
- label.textColor = UIColor(red: 0.2, green: 0.8, blue: 0.2,alpha: 1)
- }
- else{
- label.text = "Mauvaise réponse !"
- label.textColor = UIColor.red
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement