user214155 user214155 - 1 year ago 252
iOS Question

Objective-C: Progress view programmatically

How can I create

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

Answer Source

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

First you need to add and import

#import <QuartzCore/QuartzCore.h>


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];



Circular Progress View

Progress View Using Bezir Path

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download