天天看点

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()

        }

}