Making UIProgressView Rounded corners

前端 未结 13 1677
旧巷少年郎
旧巷少年郎 2021-02-07 13:59

I have created a UIProgressView with following properties

progressView.progressTintColor = UIColor.appChallengeColorWithAlpha(1.0)
progressView.trac         


        
13条回答
  •  终归单人心
    2021-02-07 15:01

    Basically progress view's (Default Style) subviews consist of 2 image view. One for the "progress", and one for the "track". You can loop the subviews of progress view, and set the each of image view's corner radius.

    for let view: UIView in self.progressView.subviews {
        if view is UIImageView {
            view.clipsToBounds = true
            view.layer.cornerRadius = 15
        }
    }
    

提交回复
热议问题