I created a UIProgressView (bar style) in Swift 2.2 and would now like to alter its height. Some other posts suggested to use CGAffineTransformScale
to change the height. However, for some reason this approach doesn't seem to work, as it does not have any effect on the height of the UIProgressView.
Below you will find my code:
let progressBar = UIProgressView(progressViewStyle: .Bar)
progressBar.progress = 0.5
progressBar.translatesAutoresizingMaskIntoConstraints = false
progressBar.transform = CGAffineTransformScale(progressBar.transform, 1, 20)
self.navigationItem.titleView = progressBar
I appreciate your help, thanks a lot!
You can subclass
UIProgressView
, and add aheight
property:The result:
In the
vc
, you initial thecustomProgressvView
, and set theheight
: