'I can't add UIProgressView in StackView
According to this code, I need to add 4 UIProgressViews to the StackView, but only 1 UIProgressView is added to the StackView. I am using Horizontal StackView.
Code:
class ViewController: UIViewController {
@IBOutlet weak var imageView: UIImageView!
@IBOutlet weak var stackView: UIStackView!
var progressView: UIProgressView = {
var view = UIProgressView()
view.tintColor = .white
view.progress = 0.5
return view
}()
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view.
for _ in 1...4 {
stackView.addArrangedSubview(progressView)
}
}
}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|


