28 Mar 2017

Progress View as Battery showing in Vertically & Horizontally...


Progress View as Battery showing in Vertically & Horizontally...



NOTE: To give different Tint color Must give   progressView.progressTintColor progressView.progressTintColor = [UIColor ChooseColor]; on the Top of [[progressView layer]setFrame:CGRectMake(801006030)];

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.
    

// ***** Verical Position
    
    UIProgressView *progressView = [[UIProgressView alloc] initWithProgressViewStyle:UIProgressViewStyleDefault];
    progressView.progressTintColor = [UIColor blueColor];
    [[progressView layer]setFrame:CGRectMake(80, 100, 60, 30)];
    [[progressView layer]setBorderColor:[UIColor redColor].CGColor];
    progressView.trackTintColor = [UIColor clearColor];
    [[progressView layer]setBorderWidth:2];
    [[progressView layer]setMasksToBounds:TRUE];
    progressView.clipsToBounds = YES;
    [progressView setProgress:0.8];
    [progressView setTransform:CGAffineTransformMakeRotation(3 *M_PI / 2)];
    [self.view addSubview:progressView];

    
// ***** Horizontal Position with corner radius
   
    UIProgressView *progressView2 = [[UIProgressView alloc] initWithProgressViewStyle:UIProgressViewStyleDefault];
    progressView2.progressTintColor = [UIColor purpleColor];
    [[progressView2 layer]setFrame:CGRectMake(80, 180, 60, 30)];
    [[progressView2 layer]setBorderColor:[UIColor redColor].CGColor];
    progressView2.trackTintColor = [UIColor clearColor];
    [[progressView2 layer]setBorderWidth:2];
    progressView2.layer.cornerRadius = 18;
    [[progressView2 layer]setMasksToBounds:TRUE];
    progressView2.clipsToBounds = YES;
    [progressView2 setProgress:0.5];
    [self.view addSubview:progressView2];
    
}



No comments:

Post a Comment

Recent Posts

Codable demo

Link: https://www.dropbox.com/s/kw7c1kgv1628bh7/codableDemo.zip?dl=0