Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
15 views

Uikit Viewcontroller: (Outputlabel: ? Currentcount Viewdidload (.

This document contains the code for a ViewController class written in Swift. The class contains properties to track a count and label, and methods to increment or decrement the count when buttons are pressed. The label then displays the updated count and changes color depending on the button.

Uploaded by

Anonymous yqSedL
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
15 views

Uikit Viewcontroller: (Outputlabel: ? Currentcount Viewdidload (.

This document contains the code for a ViewController class written in Swift. The class contains properties to track a count and label, and methods to increment or decrement the count when buttons are pressed. The label then displays the updated count and changes color depending on the button.

Uploaded by

Anonymous yqSedL
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

//

//
//
//
//
//
//

ViewController.swift
ctapp
Created by anthony edwards on 6/23/15.
Copyright (c) 2015 Anthony Edwards. All rights reserved.

import UIKit
class ViewController: UIViewController {
@IBOutlet var outputLabel: UILabel? = UILabel()
var currentCount = 0
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.
}
@IBAction func addOneButton(sender: UIButton) {
currentCount = currentCount + 1
outputLabel?.text = "The button has been clicked
\(currentCount) number of times"
outputLabel?.textColor = UIColor.redColor()
}
@IBAction func minsOneButton(sender: UIButton) {
currentCount = currentCount - 1
outputLabel?.text = "The button has been clicked
\(currentCount) number of times"
outputLabel?.textColor = UIColor.purpleColor()
}

You might also like