0

How can I create progressView programmatically with height 50 and rounded corners in my Xcode project?

if I use this code

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

rounded corners disappear

user214155
  • 111
  • 1
  • 1
  • 8

3 Answers3

2

I tried getting progress view with rounded corners.I got it.

First you need to add and import

#import <QuartzCore/QuartzCore.h>

Then

UIProgressView *progressView;
progressView = [[UIProgressView alloc] initWithProgressViewStyle:UIProgressViewStyleDefault];
progressView.progressTintColor = [UIColor colorWithRed:187.0/255 green:160.0/255 blue:209.0/255 alpha:1.0];
[[progressView layer]setFrame:CGRectMake(20, 50, 200, 200)];
[[progressView layer]setBorderColor:[UIColor redColor].CGColor];
progressView.trackTintColor = [UIColor clearColor];
[progressView setProgress:(float)(50/100) animated:YES];  ///15

[[progressView layer]setCornerRadius:progressView.frame.size.width / 2];
[[progressView layer]setBorderWidth:3];
[[progressView layer]setMasksToBounds:TRUE];
progressView.clipsToBounds = YES;

[self.view addSubview:progressView];

Also

KAProgressLabel

Circular Progress View

Progress View Using Bezir Path

Community
  • 1
  • 1
user3182143
  • 9,459
  • 3
  • 32
  • 39
0
 UIProgressView *progressView = [[UIProgressView alloc] initWithProgressViewStyle:whateverStyle]
progressView.progress = 0.75f;

//setting height and corner

[[UIProgressView appearance] setFrame:CGRectMake(20, 100, 280, 50)];
[progressView.layer setCornerRadius:4];
 progressView.layer.masksToBounds = TRUE;
 progressView.clipsToBounds = TRUE;

[self.view addSubview: progressView]
remyr3my
  • 768
  • 1
  • 6
  • 19
0

You can use this code:

UIProgressView *progressView = [[UIProgressView alloc] initWithProgressViewStyle:UIProgressViewStyleBar];
    progressView.progress = 0.75f;
    [progressView.layer setCornerRadius:10];
    progressView.layer.masksToBounds = TRUE;
   progressView.clipsToBounds = TRUE;
    CGAffineTransform transform = CGAffineTransformMakeScale(1.0f, 10.0f);
    progressView.transform = transform;

    [self.view addSubview: progressView];
Saurabh Jain
  • 1,688
  • 14
  • 28