2

Is there a way to change the height of a progress view bar in Xcode?

I am using Xcode 4.3 and need a vertical progress bar. I rotated the bar but now cannot change the height and is displays as a circle.

Also a more effective way to rotate the progress bar would be helpful.

Thanks!

Amelia777
  • 2,664
  • 2
  • 16
  • 11
  • see my answer here: http://stackoverflow.com/questions/3437564/how-to-increase-height-of-uiprogressview by using the iOS5 UIAppearance protocol – Jason Oct 01 '13 at 06:09

6 Answers6

14

Some have reported that changing it's frame manually will work:

[self.progressView setFrame:CGRectMake(0, 0, 300, 25)];

Whereas others have reported that a CGAffineTransform() works as well:

[self.progressView setTransform:CGAffineTransformMakeScale(1.0, 3.0)];

As for rotation, use:

#define DEGREES_TO_RADIANS(angle) ((angle) / 180.0 * M_PI)
[self.progressView setTransform:CGAffineTransformMakeRotation(DEGREES_TO_RADIANS(angle))];
CodaFi
  • 43,043
  • 8
  • 107
  • 153
2

This question is already answered here How to increase height of UIProgressView

@implementation UIProgressView (customView)

-(CGSize)sizeThatFits:(CGSize)size {
    CGSize newSize = CGSizeMake(self.frame.size.width,9);
    return newSize;
}
@end
Community
  • 1
  • 1
Shoaib
  • 1,295
  • 15
  • 22
1

Here code is help for you. you want to set uislider height change CGAffineTransformMakeScale height.

    UISlider *slider_progres = [[UIProgressView alloc]initWithFrame:CGRectMake(0, 56, 320, 15)];

    CGAffineTransform transform = CGAffineTransformMakeScale(1.0f, 3.0f);

    slider_progres.transform = transform;
0

I've just had a similar problem to this in iOS 7.

If you use [UIProgressView appearance] to set the progress and track images, the progress view will appear correctly for progress bars loaded from a Xib file.

If however you programatically create a UIProgressView (after setting images through appearance), the appearance images will be used however it's height will be stuck and "2", the progress bar will be clipped and even calling setFrame won't fix it.

The fix is to programatically set the images directly on the programatically created UIProgressView - rather than relying on the appearance settings.

Brad Robinson
  • 44,114
  • 19
  • 59
  • 88
0

I think it will help you.

[self.progressView setTransform:CGAffineTransformMakeScale(1.0, 3.0)];
Atanu Mondal
  • 1,714
  • 1
  • 24
  • 30
0

For me that works only if you inherit from UIProgressView class.

[self.progressView setTransform:CGAffineTransformMakeScale(1.0, 3.0)];

Example:

    @implementation CustomProgressView

        - (id)initWithCoder:(NSCoder *)aDecoder
        {
            self = [super initWithCoder:aDecoder];
            if (self) {
                [self setTransform:CGAffineTransformMakeScale(1.0, 3.0)];

            }
            return self;
        }
    @end

Other class:

@property (weak, nonatomic) IBOutlet CustomProgressView *cProgressView;
Tzegenos
  • 837
  • 12
  • 16