Use JTNumberScrollAnimatedView for have a nice animation for display number. It's easy to use, easy to customize.
With CocoaPods, add this line to your Podfile.
pod 'JTNumberScrollAnimatedView', '~> 1.0'
You can use JTNumberScrollAnimatedView like a normal view.
#import <UIKit/UIKit.h>
#import "JTNumberScrollAnimatedView.h"
@interface ViewController : UIViewController
@property (weak, nonatomic) IBOutlet JTNumberScrollAnimatedView *animatedView;
@endYou just have to call setValue with a NSNumber and use startAnimation for launch the animation.
- (void)viewDidLoad
{
[super viewDidLoad];
[self.animatedView setValue:@249];
}
- (void)viewDidAppear:(BOOL)animated
{
[super viewDidAppear:animated];
[self.animatedView startAnimation];
}For now the value must be a positive integer.
You can easily change some properties of the animation.
Each caracter have its own column.
textColorfontduration, default to1.5durationOffset, delay between the end of the animation of each column, default to0.2density, number of characters added by column for the animation, default to5minLength, you can force the minimum count of columns, default to0isAscending, the direction of the scroll, default toNO
If you change one of this properties, you have to call setValue for update the view.
- iOS 7 or higher
- Automatic Reference Counting (ARC)
JTNumberScrollAnimatedView is released under the MIT license. See the LICENSE file for more info.
