Home

Awesome

JBCountdownLabel

A UILabel subclass that displays a countdown

image

JBCountdownLabel is UILabel subclass that displays a countdown with a defined amount of seconds. So you can customise the label just like a native UILabel and add some cool actions:

Installation

I recommend use CocoaPods to install JBCountdownLabel. Simply add the following line to your Podfile:

Podfile

pod 'JBCountdownLabel'

But you can also just drop JBCountdownLabel.m and JBCountdownLabel.h in your project.

Usage

Add the label to your view:

self.countdownLabel = [[JBCountdownLabel alloc] initWithFrame:CGRectMake(0, 50, 320, 46) format:@"Initiating ignition in %@" time:300 delegate:self];
self.countdownLabel.textColor = [UIColor colorWithRed:0.48 green:0.63 blue:0.07 alpha:1];
[self.view addSubview:self.countdownLabel];

You can change the countdown behaviour:

- (void)restartCountdown;
- (void)cancelCountdown;
- (void)setTime:(int)seconds;

There is an optional delegate callback to get notified when the countdown ended:

- (void)countdownFinnishInCountdown:(JBCountdownLabel *)countdown;

Demo

Build and run the JBCoundownLabelSampleProject project in Xcode to see JBCountdownLabel in action.

This code has been created originally to provide a countdown on the activation screen of meets Download the app and test it for free! Feedback is welcome!

Communication

Contact

Javier Berlana

License

JBCountdownLabel is available under the MIT license. See the LICENSE file for more info.

-- ###meets, create and discover plans with your friends.###