#2.擇偶條件App: 你夠了解我嗎?

➤作業目的:學習 IBOutlet,IBAction 和 if else

你夠了解我嗎?
趕快來測試看看吧!O____<

import UIKitclass ViewController: UIViewController {
@IBOutlet weak var textField: UITextField!@IBOutlet weak var bloodTypeSegment: UISegmentedControl!@IBOutlet weak var animalSwitch: UISwitch!@IBOutlet weak var heightSlider: UISlider!@IBOutlet weak var heightNumber: UILabel!
@IBOutlet weak var cryImageView: UIImageView!@IBOutlet weak var bingoImage: UIImageView!
override func viewDidLoad() {super.viewDidLoad()// Do any additional setup after loading the view, typically from a nib.}
@IBAction func height(_ sender: UISlider) {heightNumber.isHidden = falseheightNumber.text = String(Int(sender.value))}
@IBAction func okButton(_ sender: AnyObject) {let star = textField.text!let blood = bloodTypeSegment.selectedSegmentIndexlet animalLover = animalSwitch.isOnlet height = Int(heightSlider.value)
if star == “射手座” && blood == 0 && animalLover && height == 158 {bingoImage.isHidden = falsecryImageView.isHidden = true} else {bingoImage.isHidden = truecryImageView.isHidden = false}}}

--

--