天天看點

UI元件:ProgressView進度條

1.定義一個進度條:

@IBOutlet var progressView1: UIProgressView!

2.添加事件:

progressView1.progress = 0

NSTimer.scheduledTimerWithTimeInterval(1, target: self, selector: "changeProgress:", userInfo: nil, repeats: true)

3.實作方法:

func changeProgress(sender:NSTimer){

        progressView1.progress += 0.1

        if(progressView1.progress >= 1)

        {

            sender.invalidate()

        }

}