码迷,mamicode.com
首页 > 其他好文 > 详细

2_Cat Years

时间:2016-01-26 18:32:07      阅读:199      评论:0      收藏:0      [点我收藏+]

标签:

2

//
//  ViewController.swift
//  Cat Years
//
//  Created by ZC on 16/1/6.
//  Copyright © 2016年 ZC. All rights reserved.
//

import UIKit

class ViewController: UIViewController {
    
    @IBOutlet weak var catYearsTextField: UITextField!
    
    @IBOutlet weak var resultYears: UILabel!
    
    @IBAction func findResult(sender: AnyObject) {
        
        if(catYearsTextField != nil){
            
            var catAge = Int(catYearsTextField.text!)!
            
            catAge = catAge * 7
            
            resultYears.text = "Your cat‘s age is \(catAge) in cat years!"
            
            
        }else{
            resultYears.text = "Please input your cat‘s age!"
        }
        
    }
    
    
    
    
    

    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.
    }


}

项目:2_Cat Years

2_Cat Years

标签:

原文地址:http://www.cnblogs.com/zcdll/p/5160991.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!