     ///Actions & Callbacks
     func startStopButtonTapped(sender: UIButton) {
         isCounting = !isCounting //切换了isCounting的状态
-        
+
         if isCounting {
             createAndFireLocalNotificationAfterSeconds(remainingSeconds)
         } else {

    }

    //累加时间
    func timeButtonTapped(sender:  UIButton) {
        let (_, seconds) = timeButtonInfos[sender.tag]
        remainingSeconds += seconds
    }
    
    func updateTimer(timer: NSTimer) {
        remainingSeconds -= 1
        
        // 弹出警告窗口,提示倒计时完成
        if remainingSeconds <= 0 {
            let alert = UIAlertView()
            
            alert.title = "计时完成"
            alert.message = ""
            alert.addButtonWithTitle("OK")
            alert.show()
        }
    }
    
    ///
    
    func setSettingButtonsEnabled(enabled: Bool) {
        for button in timeButtons! {
            button.enabled = false
            button.alpha = enabled ? 1.0 : 0.3
        }
        
        clearButton!.enabled = enabled
        clearButton!.alpha = enabled ? 1.0 : 0.3
    }
    
    //注册系统通知
    func createAndFireLocalNotificationAfterSeconds(seconds: Int) {
        
        UIApplication.sharedApplication().cancelAllLocalNotifications()
        let notification = UILocalNotification()
        
        let timeIntervalSinceNow = Double(seconds)
        
        notification.fireDate = NSDate(timeIntervalSinceNow:timeIntervalSinceNow);
        
        notification.timeZone = NSTimeZone.systemTimeZone()
        notification.alertBody = "计时完成！"
        
        UIApplication.sharedApplication().scheduleLocalNotification(notification)
        
    }
    
}


        setupTimeLabel()
        setuptimeButtons()
        setupActionButtons()

        remainingSeconds = 0
    }

    override func didReceiveMemoryWarning() {
