crewshin
crewshin

Reputation: 775

UIProgressView scaling issue

I'm having this odd issue with UIProgressView. This video will explain better than I can with words...

https://vimeo.com/45399884 password: stackoverflow

But basically, I have a UIProgressView that uses iOS5's new setProgress:animated method. I'm animating it but when it animates, the slider part of the control is being scaled from the view's bounds 0,0 to bounds.size.max,bounds.size.max. It animates from left to right properly (with one exception), but scales at the same time. So basically it looks like a diagonal slide.

This is every bit of my progress view code.

progressView = [[UIProgressView alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, 11)];
[self.view addSubview:progressView];
[progressView setProgressViewStyle:UIProgressViewStyleBar];
[progressView setProgress:refreshInterval animated:YES];

Any tips or advice is appreciated. Thanks.

Upvotes: 1

Views: 1291

Answers (2)

Jason Coco
Jason Coco

Reputation: 78363

The designated initializer for UIProgressView is -initWithProgressViewStyle:. You're not supposed to modify the height of a progress bar, and while the height of the bar-style progress bar is 11, there are probably some effects being initialized in -initWithProgressViewStyle: that you're missing since the default height for the control is 9.

Upvotes: 1

Jeff Kelley
Jeff Kelley

Reputation: 19071

The designated initializer for a UIProgressView appears to be -initWithProgressBarStyle:. Try creating it using that method.

Upvotes: 0

Related Questions