Byte Byte - 1 year ago 264
iOS Question

How to create non rounded corner UIProgressView in ios using Swift

I have subclassed UIProgressView as

import UIKit

class MyProgressView: UIProgressView {

override func sizeThatFits(size: CGSize) -> CGSize {
return CGSizeMake(size.width, 6)


and I am using it as

let progress = YASProgressView()

progress.progress = 0.33
progress.layer.cornerRadius = 0
progress.tintColor = UIColor.whiteColor()
progress.trackTintColor = UIColor.whiteColor().colorWithAlphaComponent(0.4)
navigationItem.titleView = progress

its working fine But it have rounded corners like below

enter image description here

I want it to be non rounded corner How can I do that ?

Please guide

Answer Source

Simply change the progressViewStyle to UIProgressViewStyle.Bar, Default is UIProgressViewStyle.Default

self.progressViewStyle = UIProgressViewStyle.Bar
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download