label, bottun, text로 이루어져 있다.
//
// ViewController.swift
// Gsh
//
// Created by Apple7 on 2015. 9. 23..
// Copyright © 2015년 gsh. All rights reserved.
//
import UIKit
class ViewController: UIViewController {
@IBOutlet weak var inputText: UITextField!
@IBOutlet weak var resultText: UILabel!
// 변환
@IBAction func convertButton(sender: AnyObject) {
resultText.text = "\(inputText.text!)°F는 \(((inputText.text! as NSString).doubleValue - 32)/1.8)°C"
}
// 키보드 감추기
@IBAction func keyHiden(sender: AnyObject) {
sender.resignFirstResponder()
}
override func touchesBegan(touches: Set<UITouch>, withEvent event: UIEvent?) {
inputText.endEditing(true)
}
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.
}
}