Last active
August 29, 2015 14:16
-
-
Save masakid/66aaa3f46deffe8f6c56 to your computer and use it in GitHub Desktop.
lesson1+
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
// | |
// ViewController.swift | |
// Problem_part1 | |
// | |
import UIKit | |
class ViewController: UIViewController { | |
@IBOutlet var textField: [UITextField]! | |
@IBOutlet weak var resultLabel: UILabel! | |
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 pressCalcButton(sender: AnyObject) { | |
//配列作成、reduceでそれぞれ足し合わせる | |
self.resultLabel.text = "\(self.textField.reduce(0){ $0 + ($1.text.toInt() ?? 0)})" | |
} | |
@IBAction func didEndOnExit(sender: AnyObject) { | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment