OJFSegmentedProgressView

I've always been good at creating "parts" of apps but I have trouble completing the rest of the app to go around it.

So I decided to create an open-source iOS control and make it available through CocoaPods.

The control is a segmented progress view, it displays progress between 0.0 and 1.0 in segments. It is a control I created for a full app but it was never used. I also didn't add much flexibility to it originally.

I started from scratch over the weekend. My goal was to provide as many of the functions available with UIProgressView as possible to make it as easy to swap out and learn as possible.

The result is OJFSegmentedProgressView.

Using the control is simple. Install it using CocoaPods and set the view up with code like the following...

- (void)viewDidLoad
{
    [super viewDidLoad];

    OJFSegmentedProgressView *progressView = [[OJFSegmentedProgressView alloc] initWithNumberOfSegments:13];
    [progressView setFrame:CGRectMake(20, 100, 280, 20)];
    [progressView setTrackTintColor:[UIColor lightGreyColor]];
    [progressView setProgressTintColor:[UIColor darkGreyColor]];
    [progressView setStyle:OJFSegmentedProgressViewStyleContinuous];
    [self.view addSubView:progressView];
}

The control also works if added to a view in InterfaceBuilder (add a UIView and change the subclass).

Here is a quick video of the control in action...

One of the best things I've discovered about creating and sharing controls like this is the feeling of achievement you get when you see other people exploring and using your control. It's still too early to celebrate any great successes but a couple of people have "starred" my github repo and it really made me feel good to be able to contribute.

Leave a Reply

Your email address will not be published. Required fields are marked *