Last active
August 29, 2015 14:17
-
-
Save masakid/48984915cb07398c0852 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
// | |
// MinusViewController.swift | |
// Problem_part7 | |
// | |
// Created by masakid on 2015/03/23. | |
// Copyright (c) 2015年 masaki.k. All rights reserved. | |
// | |
import UIKit | |
class MinusViewController: UIViewController { | |
@IBOutlet weak var minusNum1: UITextField! | |
@IBOutlet weak var minusNum2: UITextField! | |
@IBOutlet weak var minusResult: UILabel! | |
override func viewDidLoad() { | |
super.viewDidLoad() | |
self.minusNum1.keyboardType = UIKeyboardType.NumberPad | |
self.minusNum2.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 pressMinusButton(sender: AnyObject) { | |
let num1 = (self.minusNum1.text as NSString).integerValue | |
let num2 = (self.minusNum2.text as NSString).integerValue | |
let answer = num1 - num2 | |
self.minusResult.text = "\(answer)" | |
self.minusNum1.resignFirstResponder() | |
self.minusNum2.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