Created
April 21, 2015 16:27
-
-
Save kenji272/1943d4fe6362feb4d9da to your computer and use it in GitHub Desktop.
【課題】Part4 数字をカウントアップするアプリを作る
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import UIKit | |
class ViewController: UIViewController { | |
@IBOutlet weak var targetTextField: UITextField! | |
@IBOutlet weak var resultLabel: UILabel! | |
var resultCount: Int = 0 | |
override func viewDidLoad() { | |
super.viewDidLoad() | |
// ラベル初期化 | |
self.resultLabel.text = "0" | |
} | |
override func didReceiveMemoryWarning() { | |
super.didReceiveMemoryWarning() | |
} | |
// インクリメント処理 | |
@IBAction func increment(sender: AnyObject) { | |
self.resultCount++ | |
self.resultLabel.text = "\(self.resultCount)" | |
} | |
// クリア処理 | |
@IBAction func clear(sender: AnyObject) { | |
self.resultCount = 0 | |
self.resultLabel.text = "0" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment