zoukankan      html  css  js  c++  java
  • 6_StopWatch

    6

    //
    //  ViewController.swift
    //  StopWatch
    //
    //  Created by ZC on 16/1/9.
    //  Copyright © 2016年 ZC. All rights reserved.
    //
    
    import UIKit
    
    class ViewController: UIViewController {
        
        var timer = NSTimer()
        
        var time = 0
        
        func increaseTimer() {
            
            time++
            
            timeLabel.text = String(time)
            
        }
        
        @IBOutlet weak var timeLabel: UILabel!
        
        
        @IBAction func play(sender: AnyObject) {
            
            timer = NSTimer.scheduledTimerWithTimeInterval(1, target: self, selector: Selector("increaseTimer"), userInfo: nil, repeats: true)
            
        }
        
        @IBAction func pause(sender: AnyObject) {
            
            timer.invalidate()
            
        }
        
        @IBAction func stop(sender: AnyObject) {
            
            timer.invalidate()
            
            time = 0
            
            timeLabel.text = "0"
        }
    
        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.
        }
    
    
    }
    

    项目:6_StopWatch

  • 相关阅读:
    线性代数学习路线
    补充.关于秩的不等式
    第十讲.无关性、基与维数
    第九讲.Ax = b
    第八讲.Ax = 0
    大三下学期第一个月反思
    第六讲.LU分解
    第五讲.矩阵的逆
    第四讲.矩阵的运算
    NAT 实验
  • 原文地址:https://www.cnblogs.com/zcdll/p/5161035.html
Copyright © 2011-2022 走看看