// // ViewController.swift // iOSSwitch // // Created by Michael Wilhelm on 3/04/2016. // Copyright © 2016 Michael Wilhelm. All rights reserved. // import UIKit class ViewController: UIViewController { // UIAtrribute @IBOutlet var uiSwitch: UISwitch! @IBOutlet var labelErgebnis: UILabel! @IBOutlet var labelErgebnis2: UILabel! // Events @IBAction func bnActionClick(sender: AnyObject) { if uiSwitch.on { labelErgebnis.text = "switch ist an" } else { labelErgebnis.text = "switch ist aus" } } @IBAction func uiSwitchonChange(sender: AnyObject) { if uiSwitch.on { labelErgebnis2.text = "switch ist an" } else { labelErgebnis2.text = "switch ist aus" } } override func viewDidLoad() { super.viewDidLoad() // Do any additional setup after loading the view, typically from a nib. } override func didReceiveMemoryWarning() { super.didReceiveMemoryWarning() // Dispose of any resources that can be recreated. } }