Last active
August 29, 2015 14:17
-
-
Save masakid/f5649a47acd54dbb58ae to your computer and use it in GitHub Desktop.
lesson7
This file contains hidden or 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
// | |
// PlusViewController.swift | |
// Problem_part7 | |
// | |
// Created by masakid on 2015/03/23. | |
// Copyright (c) 2015年 masaki.k. All rights reserved. | |
// | |
import UIKit | |
class PlusViewController: UIViewController { | |
@IBOutlet weak var plusNum1: UITextField! | |
@IBOutlet weak var plusNum2: UITextField! | |
@IBOutlet weak var plusResult: UILabel! | |
override func viewDidLoad() { | |
super.viewDidLoad() | |
self.plusNum1.keyboardType = UIKeyboardType.NumberPad | |
self.plusNum2.keyboardType = UIKeyboardType.NumberPad | |
// Do any additional setup after loading the view. | |
} | |
override func didReceiveMemoryWarning() { | |
super.didReceiveMemoryWarning() | |
// Dispose of any resources that can be recreated. | |
} | |
@IBAction func pressPlusButton(sender: AnyObject) { | |
let num1 = (self.plusNum1.text as NSString).integerValue | |
let num2 = (self.plusNum2.text as NSString).integerValue | |
let answer = num1 + num2 | |
self.plusResult.text = "\(answer)" | |
self.plusNum1.resignFirstResponder() | |
self.plusNum2.resignFirstResponder() | |
} | |
/* | |
// MARK: - Navigation | |
// In a storyboard-based application, you will often want to do a little preparation before navigation | |
override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) { | |
// Get the new view controller using segue.destinationViewController. | |
// Pass the selected object to the new view controller. | |
} | |
*/ | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment