iOS倒计时的动画效果
2015-05-09 17:03
253 查看
转自:http://blog.csdn.net/gaoyp/article/details/20522289
-(void)countDown:(int)count{
if(count <=0){
//倒计时已到,作需要作的事吧。
return;
}
UILabel* lblCountDown = [[UILabel alloc] initWithFrame:CGRectMake(260, 120, 50, 50)];
lblCountDown.textColor = [UIColor redColor];
lblCountDown.font = [UIFont boldSystemFontOfSize:66];
lblCountDown.backgroundColor = [UIColor clearColor];
lblCountDown.text = String(@"%d",_SettedCountDown);
[self.view addSubview:lblCountDown];
[UIView animateWithDuration:1
delay:0
options:UIViewAnimationCurveEaseOut
animations:^{
lblCountDown.alpha = 0;
lblCountDown.transform =CGAffineTransformScale(CGAffineTransformIdentity, 0.5, 0.5);
}
completion:^(BOOL finished) {
[lblCountDown removeFromSuperview];
//递归调用,直到计时为零
[self countDown:count -1];
}
];
}
-(void)countDown:(int)count{
if(count <=0){
//倒计时已到,作需要作的事吧。
return;
}
UILabel* lblCountDown = [[UILabel alloc] initWithFrame:CGRectMake(260, 120, 50, 50)];
lblCountDown.textColor = [UIColor redColor];
lblCountDown.font = [UIFont boldSystemFontOfSize:66];
lblCountDown.backgroundColor = [UIColor clearColor];
lblCountDown.text = String(@"%d",_SettedCountDown);
[self.view addSubview:lblCountDown];
[UIView animateWithDuration:1
delay:0
options:UIViewAnimationCurveEaseOut
animations:^{
lblCountDown.alpha = 0;
lblCountDown.transform =CGAffineTransformScale(CGAffineTransformIdentity, 0.5, 0.5);
}
completion:^(BOOL finished) {
[lblCountDown removeFromSuperview];
//递归调用,直到计时为零
[self countDown:count -1];
}
];
}
相关文章推荐
- iOS倒计时的动画效果
- iOS 基本动画、关键帧动画、利用缓动函数实现物理动画效果
- IOS学习之核心动画-粒子效果
- iOS学习之自定义弹出UIPickerView或UIDatePicker(动画效果)
- IOS自带view动画效果
- 仿iOS原生弹出视图效果的 HUD的弹出动画
- ios 动画效果
- IOS 动画效果
- IOS开发-UIView之动画效果的实现方法(合集)
- IOS开发-UIView之动画效果的实现方法(合集)
- iOS 动画效果:Core Animation & Facebook's pop
- Android UI设计之<二>自定义SwitchButton开关,实现类似IOS中UISwitch的动画效果
- iOS核心动画笔记3-视觉效果
- iOS UIView animation动画效果 (1)
- IOS 动画设计(5)——用缓动函数实现物理动画效果
- iOS开发UIImage和UIImageView属性介绍,实现图片动画,实现开始/停止按钮效果
- iOS 开发中问题 ——使用xib拖拽控件操作其约束并添加动画没有效果的问题
- iOS自带动画效果的实例代码
- iOS(学习) 一个简单的动画效果
- PNChart,简洁高效有动画效果的iOS图表库