         super.viewDidLoad()
 
         setup()
+        
+        timer = NSTimer.scheduledTimerWithTimeInterval(1, target: self, selector: Selector("timerEvent"), userInfo: nil, repeats: true)
     }
 
     override func didReceiveMemoryWarning() {

    private func setup01() {
        
        // 创建形状遮罩
        let startAngle = CGFloat( (M_PI * 0) ) / 180
        let endAngle   = CGFloat( (M_PI * 360) ) / 180
        dashCircleLayer = CAShapeLayer.instance(circleCenter: CGPointMake(CGRectGetWidth(view.bounds)/2, 50 + 36), radius: 50, startAngle: startAngle, endAngle: endAngle, clockwise: true, lineDashPattern: [10,10])
        
        dashCircleLayer.strokeColor = UIColor.blackColor().CGColor // 边缘线的颜色
        dashCircleLayer.lineCap     = kCALineCapSquare             // 边缘线的类型

        dashCircleLayer.strokeStart = 0
        dashCircleLayer.strokeEnd   = 1
        
    }
    
    // MARK: - 设置渐变颜色层
    
    private func setup02() {
        
        // 创建渐变图层
        faucet = CAGradientLayer()
        faucet.frame = CGRectMake(0, 0, radius*2, radius*2)
        faucet.position = CGPointMake(CGRectGetWidth(view.bounds)/2, radius + 36)
        
        // 以CAShapeLayer的形状作为遮罩是实现特定颜色渐变的关键
        faucet.mask = dashCircleLayer
        faucet.colors = [
            UIColor.greenColor().CGColor,
            UIColor.redColor().CGColor,
            UIColor.cyanColor().CGColor,
            UIColor.purpleColor().CGColor,
            UIColor.yellowColor().CGColor
        ]
        
        // 设定动画时间
        faucet.speed = 0.5
        
        // 添加到系统图层中
        view.layer.addSublayer(faucet)
        
    }

}
