创建UIProgressView
let progressView = UIProgressView(progressViewStyle:.Default) progressView.frame = CGRectMake(20, 100, 300, 0) self.view.addSubview(progressView)
设置属性
progressView.transform = CGAffineTransformMakeScale(1, 5)//修改进度条宽高 progressView.progress = 0.1//进度 progressView.progressTintColor = UIColor.greenColor()//已有进度颜色 progressView.trackTintColor = UIColor.lightGrayColor()//剩余进度颜色
两秒后更新进度
self.performSelector(Selector("animationProgress:"), withObject: progressView, afterDelay: 2)
func animationProgress(progressView : UIProgressView){ progressView.setProgress(1, animated: true) }