Skip to content

Latest commit

 

History

History
37 lines (23 loc) · 1.51 KB

README.md

File metadata and controls

37 lines (23 loc) · 1.51 KB

CircularProgressTimer

Circular Progress Timer working demo in Objective-C for iOS 6+

This is my take on a control that is getting too mainstream :) Is a snippet of what I used on the Madrid Bus App:

Component screenshot

The project uses Interface Builder only for the main View Controller, but the circular progress view is built programatically.

No extra frameworks needed, just UIKit.

  1. Copy and paste CircularProgressBarView header and implementation files into your project. Don't forget the circle.png and circle@2x.png files.
  2. Kick-off a timer with a one second interval whose action points to the progress bar drawing method. You can see the full example in MainViewController.m:
    timer = [NSTimer scheduledTimerWithTimeInterval:1.0
                                             target:self
                                           selector:@selector(updateCircularProgressBar)
                                           userInfo:nil
                                            repeats:YES];
  1. In the updateCircularProgressBar method, just call the drawing function passing the total amount of seconds left. Show the remaining amount of time in minutes and seconds is a simple operation:
        minutesLeft = globalTimer / 60;
        secondsLeft = globalTimer % 60;
    
        [self drawCircularProgressBarWithMinutesLeft:minutesLeft secondsLeft:secondsLeft]