swift 使用定时器 Timer

    vartimer :Timer!

    vartimeCount :Int=0

        timer=Timer.scheduledTimer(timeInterval:1, target:self, selector:#selector(self.tickDown), userInfo:nil, repeats:true)

 /*

     * 计时器每秒执行的事件

     */

    @objc functickDown(){

        print("0timeCount\(timeCount)")

        timeCount+=1

    }

你可能感兴趣的:(swift 使用定时器 Timer)