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
6_StopWatch的更多相关文章
随机推荐
- new String[0]的作用
返回包含此 collection 中所有元素的数组:返回数组的运行时类型与指定数组的运行时类型相同.如果指定的数组能容纳 该 collection,则返回包含此 collection 元素的数组.否则 ...
- Linux学习之系统时间同步
一.系统时间的设置 在Linux中设置系统时间,可以用date命令: //查看时间 [root@localhost ~]# date 2008年 12月 12日 星期五 :: CST //修改时间 [ ...
- [置顶] 蓝牙基础知识进阶——Physical channel
从本篇文章开始,晓东将会和大家一起来学习一些蓝牙的比较高阶的基础知识. 二.物理通道 物理通道是piconet区分的标准,它是蓝牙系统结构层次中的最底层了. Q1:物理通道有哪些类型 物理通道 ...
- Nginx修改配置实现图片防盗链
一般情况下,防盗链是针对软件下载和图片的,由于一般的站点不提供资源下载,所以本文主要是针对图片的防盗链 1.如果对全站图片做防盗链,至少需要一个另外的域名存放指向图片.因为如果对全站图片做了防盗链,包 ...
- Google Chrome浏览器的使用方法
Google Chrome浏览器 [原文地址:http://www.cnblogs.com/QLeelulu/archive/2011/08/28/2156402.html ] 在Google Chr ...
- codeforces 659D . Bicycle Race 几何
题目链接 对相邻的三个点叉积判断一下就好. #include <iostream> #include <vector> #include <cstdio> #inc ...
- IP校验和
#include <stdio.h> #include <unistd.h> #include <linux/if_ether.h> #include <li ...
- 转载:NSobject官方介绍
概述: NSObject协议组对所有的Object-C下的objects都生效. 如果objects遵从该协议,就会被看作是first-class objects(一级类). 另外,遵从该协议的obj ...
- html---id,name和value
id是唯一标识符,不允许有重复值(类似数据表的主键,pk),可以通过它的值来获得对应的html标签对象.(如果在同一页面代码中,出现重复的id,会导致不可预料的错误) js代码可通过document. ...
- Windows Azure Web Role 的 IIS 重置
如果您是一名 Web开发人员,您很可能使用过"简单快捷"的iisreset命令重置运行不正常的 IIS主机.这种方法通常在经典的 Windows Server VM上非常有效 ...