[IOS] Timer with Swift


stop
timer.invalidate();

var timerCount = 0
var timerRunning = false
var timer = NSTimer()

start:
timer = NSTimer.scheduledTimerWithTimeInterval(1, target:self, selector: Selector("Counting"), userInfo: nil, repeats: true)

timerRunning = true, false

func Counting () {
timerCount += 1
timerLabel.text = "\(timerCount)"
}

restart:
timerCount = 0
timerLabel.text = "0"

Đăng bởi Unknown lúc lúc tháng 2 15, 2015 0 bình luận
Tags:

Không có nhận xét nào:

Đăng nhận xét

Copyright © 2018. NguyenQuangVinh.net, Edit by Daotaotinhoc.vn