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

6_StopWatch的更多相关文章

随机推荐

  1. @property和@synthesize

    main.m #import <Foundation/Foundation.h> #import "Student.h" int main(int argc, cons ...

  2. Spring-----Spring Jar包

    转载自:http://blog.csdn.net/hekewangzi/article/details/51713110

  3. U3D学习使用笔记(三)

    1.对动画进行播放和暂停(从初始位置) (1).老版动画系统Animation 暂停 an["Take 001"].time = 0f; an["Take 001&quo ...

  4. Android 如何修改自动同步数据的默认开关 M

    前言          欢迎大家我分享和推荐好用的代码段~~ 声明          欢迎转载,但请保留文章原始出处:          CSDN:http://www.csdn.net        ...

  5. jQuery 源码分析和使用心得 - 文档遍历 ( traversing.js )

    jQuery之所以这么好用, 首先一点就是$()方法和它强大的选择器. 其中选择器使用的是sizzle引擎, sizzle是jQuery的子项目, 提供高效的选择器查询. 有个好消息告诉大家, 就是s ...

  6. Could not lock surface java.lang.IllegalArgumentException

    08-07 14:46:33.795: E/Surface(4927): dequeueBuffer failed (Invalid argument) 08-07 14:46:33.800: E/V ...

  7. Flink资料(1)-- Flink基础概念(Basic Concept)

    Flink基础概念 本文描述Flink的基础概念,翻译自https://ci.apache.org/projects/flink/flink-docs-release-1.0/concepts/con ...

  8. getchar()与EOF

    大师级经典的著作,要字斟句酌的去读,去理解.以前在看K&R的The C Programming Language(Second Edition)中第1.5节的字符输入/输出,很迷惑getcha ...

  9. Cortex-M3学习日志(三)-- 外部中断0

    无论是哪款单片机应该都有对应的中断的功能,中断在嵌入式系统的地位毋庸置疑.LPC1768微处理器包括4个外部中断,分别是EINT0.EINT1.EINT2.EINT3对应的引脚分别是P2.10~P2. ...

  10. 柯南君:看大数据时代下的IT架构(7)消息队列之RabbitMQ--案例(routing 起航)

    二.Routing(路由) (using the Java client) 在前面的学习中,构建了一个简单的日志记录系统,能够广播所有的日志给多个接收者,在该部分学习中,将添加一个新的特点,就是可以只 ...