DVG
DVG

Reputation: 17470

Custom UIProgressView

I'm using a UIProgressView in my application, which is working great right now. But I want to make it larger (height-wise) and color it a different color.

I'm looking to use PDColoredProgressView for the color, and alter the -(void)drawRect:(CGRect)rect method to change the height, however I can't decide where I would actually alter the height. Any suggestions on what to change?

Upvotes: 1

Views: 5855

Answers (3)

Let.Simoo
Let.Simoo

Reputation: 93

To change the height of progressView try below code: ( works with Swift 5 )


progressView.transform = CGAffineTransform(scaleX: 1, y: 4) // y present the wanted height

and 1 present the current width, so if you change it to 3 then it will mean current width x 2

Upvotes: 0

David Neiss
David Neiss

Reputation: 8237

Setting the frame side didn't seem to work for me. Setting the transform to a CGAffineTransformMakeScale() can scale it up - not sure if that causes any other problems though.

Upvotes: 2

DVG
DVG

Reputation: 17470

So it turns out you can resize it like any other view.

[coloredProgressView setFrame:CGRectMake(0, 0, 300, 25)];

Upvotes: 3

Related Questions