Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8923193
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T07:03:13+00:00 2026-06-15T07:03:13+00:00

I want to create a circular progress bar like the following: How can I

  • 0

I want to create a circular progress bar like the following:

Circular progress bar

How can I do that using Objective-C and Cocoa?

How I started doing it was creating a UIView and editing the drawRect, but I am bit lost. Any help would be greatly appreciated.

Thanks!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T07:03:15+00:00Added an answer on June 15, 2026 at 7:03 am

    The basic concept is to use the UIBezierPath class to your advantage. You are able to draw arcs, which achieve the effect you’re after. I’ve only had half an hour or so to have a crack at this, but my attempt is below.

    Very rudimentary, it simply uses a stroke on the path, but here we go. You can alter/modify this to your exact needs, but the logic to do the arc countdown will be very similar.

    In the view class:

    @interface TestView () {
        CGFloat startAngle;
        CGFloat endAngle;
    }
    
    @end
    
    @implementation TestView
    
    - (id)initWithFrame:(CGRect)frame
    {
        self = [super initWithFrame:frame];
        if (self) {
            // Initialization code
            self.backgroundColor = [UIColor whiteColor];
    
            // Determine our start and stop angles for the arc (in radians)
            startAngle = M_PI * 1.5;
            endAngle = startAngle + (M_PI * 2);
    
        }
        return self;
    }
    
    - (void)drawRect:(CGRect)rect
    {
        // Display our percentage as a string
        NSString* textContent = [NSString stringWithFormat:@"%d", self.percent];
    
        UIBezierPath* bezierPath = [UIBezierPath bezierPath];
    
        // Create our arc, with the correct angles
        [bezierPath addArcWithCenter:CGPointMake(rect.size.width / 2, rect.size.height / 2) 
                              radius:130 
                          startAngle:startAngle
                            endAngle:(endAngle - startAngle) * (_percent / 100.0) + startAngle
                           clockwise:YES];
    
        // Set the display for the path, and stroke it
        bezierPath.lineWidth = 20;
        [[UIColor redColor] setStroke];
        [bezierPath stroke];
    
        // Text Drawing
        CGRect textRect = CGRectMake((rect.size.width / 2.0) - 71/2.0, (rect.size.height / 2.0) - 45/2.0, 71, 45);
        [[UIColor blackColor] setFill];
        [textContent drawInRect: textRect withFont: [UIFont fontWithName: @"Helvetica-Bold" size: 42.5] lineBreakMode: NSLineBreakByWordWrapping alignment: NSTextAlignmentCenter];
    }
    

    For the view controller:

    @interface ViewController () {    
        TestView* m_testView;
        NSTimer* m_timer;
    }
    
    @end
    
    - (void)viewDidLoad
    {
        // Init our view
        [super viewDidLoad];
        m_testView = [[TestView alloc] initWithFrame:self.view.bounds];
        m_testView.percent = 100;
        [self.view addSubview:m_testView];
    }
    
    - (void)viewDidAppear:(BOOL)animated
    {
        // Kick off a timer to count it down
        m_timer = [NSTimer scheduledTimerWithTimeInterval:0.1 target:self selector:@selector(decrementSpin) userInfo:nil repeats:YES];
    }
    
    - (void)decrementSpin
    {
        // If we can decrement our percentage, do so, and redraw the view
        if (m_testView.percent > 0) {
            m_testView.percent = m_testView.percent - 1;
            [m_testView setNeedsDisplay];
        }
        else {
           [m_timer invalidate];
           m_timer = nil;
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want create a Circular Text with JQuery or CSS how can i do
I want to create a round circular button. This button should look like a
I'm new to C programming. I want to create circular buffer which writes strings
I want create wordpress website into which I want create user management... That means
i want create a custom json data from the mssql 2008 results so that
I want create an application with animate button? how can i do? after click
I want to create a new field (or two) in my table that is
I want to create a view that is able to show a ModelForm for
I want to create a Circluar Determinate ProgressBar, the kind which shows the Progress
Currently I have three models in Django that create a circular reference: A User

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.