I want to make UIProgressBar programmatically in swift?
what is wrong in this code?
override func viewDidLoad() {
super.viewDidLoad()
let progressView = UIProgressView(progressViewStyle: .Bar)
progressView.center = self.view.center
progressView.frame = CGRectMake(0,0,50,20)
progressView.translatesAutoresizingMaskIntoConstraints = false
progressView.setProgress(0.5, animated: false)
self.view.addSubview(progressView)
}
let progressView = UIProgressView(progressViewStyle: .Bar)
progressView.center = view.center
progressView.setProgress(0.5, animated: true)
progressView.trackTintColor = UIColor.lightGrayColor()
progressView.tintColor = UIColor.blueColor()
view.addSubview(progressView)
you need to do this type code and you can't need to set frame .
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With