项目介绍:
- – (void)viewDidLoad {
- [super viewDidLoad];
- DigitalBeatAnimation *view = [[DigitalBeatAnimation alloc]initWithFrame:CGRectMake(30, 200, self.view.frame.size.width-60, 60)];
- view.backgroundColor = UIColor.yellowColor;
- self.animationView = view;
- [self.view addSubview:view];
- UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
- [button setFrame:CGRectMake((self.view.frame.size.width-200)/2.0, 300, 200, 30)];
- [button setTitle:@"点我" forState:UIControlStateNormal];
- [button setTitleColor:UIColor.blueColor forState:UIControlStateNormal];
- [button setBackgroundColor:UIColor.grayColor];
- [button addTarget:self action:@selector(buttonTouch) forControlEvents:UIControlEventTouchUpInside];
- [self.view addSubview:button];
- }
- – (void)buttonTouch {
- self.number += arc4random()%10000;
- self.animationView.digital = [NSNumber numberWithInteger:self.number];
- [self.animationView createAnimations];
- }
复制代码
链接:https://github.com/dusmit/DigitalBeatAnimation,如果对您有所帮助请点下赞,谢谢!