首页 > 编程语言 > 详细

用swift开发计算器

时间:2015-03-01 18:34:28      阅读:481      评论:0      收藏:0      [点我收藏+]
import UIKit

class ViewController: UIViewController {

    @IBOutlet weak var display: UILabel!
    
    var userIsInputingDigit :Bool  = false
    @IBAction func appendDigit(sender: UIButton) {
        let digit =  sender.currentTitle!
         if userIsInputingDigit {
        display.text = display.text! + digit
            
        }else {
        
        display.text = digit
        userIsInputingDigit = true
        }
        
    }
    
    override func viewDidLoad() {
        super.viewDidLoad()
        // Do any additional setup after loading the view, typically from a nib.
    }

    

}

来自: https://itunes.apple.com/us/course/developing-ios-8-apps-swift/id961180099

用swift开发计算器

原文:http://my.oschina.net/itfanr/blog/381043

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!