I create progress bar in my app using this code:
let progressBar = UIProgressView(progressViewStyle: .default)
progressBar.setProgress(1.0, animated: true)
self.addSubview(progressBar)
progressBar.trackTintColor = UIColor(red: 1.0, green: 1.0, blue: 1.0, alpha: 0.2)
progressBar.tintColor = .white
let frame = CGRect(x: percentLabel.intrinsicContentSize.width + 30.0, y: 117, width: 254, height: 3)
progressBar.frame = frame
And as you can see here:
If the progress is 1.0, progress bar goes beyond the frame. Any ideas how to fix that??
the percentLabel is pushing it to the right.
To fix this, you could constrain the progress bar to always start at the position that it has in the second photo. Add a leading constraint from the progress bar to its superview. And also give it a smaller width.
Hope this helps.