0
import UIKit
class ViewController: UIViewController {
// Khai bao bien
var time:Float = 0
var timer:NSTimer!
var sliTime:Float!
// End khai bao
@IBOutlet weak var sldTime: UISlider!
@IBOutlet weak var lblScore: UILabel!
@IBOutlet weak var lblNum1: UILabel!
@IBOutlet weak var lblOperator: UILabel!
@IBOutlet weak var lblNum2: UILabel!
@IBOutlet weak var lblResult: UILabel!
@IBAction func btnOK(sender: AnyObject) {
}
@IBAction func btnCan(sender: AnyObject) {
}
override func viewDidLoad() {
super.viewDidLoad()
sldTime.minimumValue = 0
sldTime.maximumValue = 10
timer = NSTimer.scheduledTimerWithTimeInterval(1, target: self, selector: Selector("Run") ,userInfo: nil, repeats: true)
}
func Run()
{
if time == 0{
time = 10
}else{
time = time - 1
sldTime.value = time
}
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
}
當運行在模擬器應用程序,該應用顯示:夫特添加float值UISlider.value
「線程1斷點1.1」 在線sldTime.value =時間
刪除您添加的斷點和/或單擊調試器中的「繼續」按鈕。 – rmaddy