TestsTested | ✗ |
LangLanguage | Obj-CObjective C |
License | MIT |
ReleasedLast Release | Dec 2014 |
Maintained by Javier Berlana.
A UILabel
subclass that displays a countdown
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:
I recommend use CocoaPods to install JBCountdownLabel. Simply add the following line to your Podfile
:
pod 'JBCountdownLabel'
But you can also just drop JBCountdownLabel.m
and JBCountdownLabel.h
in your project.
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;
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!
Javier Berlana
JBCountdownLabel is available under the MIT license. See the LICENSE file for more info.