Is it possible to add multiple colors in a UIProgressView?

后端 未结 3 1278
清酒与你
清酒与你 2021-01-14 19:56

Basically, I want to create a custom progressview that will have different colors depending on the progress value. It should look like the following:

[-----Red----][

3条回答
  •  爱一瞬间的悲伤
    2021-01-14 20:29

    1) Create an image that has the desired color gradient in some image editing program.

    2) Put the image into your asset library.

    3) Generate a UIImage instance from the respective image.

    UIImage *image = [UIImage imageNamed:@"imageName"];
    

    4) Assign the UIImage instance to the progressImage property of UIProgressView.

    self.progressView. progressImage = image;
    

提交回复
热议问题