UILable缩小字体同比例缩小_附加倒计时
2013-10-29 14:47
537 查看
#import "ViewController.h" @interface ViewController (){ NSInteger count; //计数器 UILabel *lable; //文本试图 NSArray *textArray; //文字数组 NSTimer *timer; //定时器 } @end @implementation ViewController - (void)dealloc{ [lable release]; [textArray release]; [super dealloc]; } - (void)viewDidLoad { [super viewDidLoad]; textArray = [[NSArray alloc] initWithObjects:@"3",@"2",@"1",@"G O", nil]; lable = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, 160, 80)]; lable.textAlignment = NSTextAlignmentCenter; lable.backgroundColor = [UIColor orangeColor]; lable.font = [UIFont boldSystemFontOfSize:40]; lable.center = self.view.center; lable.text = [textArray objectAtIndex:0]; [self.view addSubview:lable]; CABasicAnimation *animationZoomOut=[CABasicAnimation animationWithKeyPath:@"transform.scale"]; animationZoomOut.duration=4; animationZoomOut.autoreverses=NO; animationZoomOut.repeatCount=1; animationZoomOut.toValue=[NSNumber numberWithFloat:0]; animationZoomOut.timingFunction=[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseOut]; [lable.layer addAnimation:animationZoomOut forKey:nil]; timer = [NSTimer scheduledTimerWithTimeInterval:0.8 target:self selector:@selector(textCheck) userInfo:nil repeats:YES]; } - (void)textCheck{ if (count < textArray.count-1) { count ++; }else{ [timer invalidate]; timer = nil; } lable.text = [textArray objectAtIndex:count]; [self.view reloadInputViews]; } @end
相关文章推荐
- Word所有字体按比例缩小
- BootStrap :环境搭建;布局容器;视口:在移动设备上使用,用于比例缩小视口内容;栅格系统;Col-屏幕尺寸-所占栅格数
- [CSS技巧] 符合Web标准!CSS同比例缩小图片
- iphone 图片等比例缩小
- UILable添加超链接图片改变字体 NIAttributedLabel
- JavaScript实现点击按钮字体放大、缩小
- js比例缩小显示图片
- PS 在PS中如何等比例放大缩小图片
- 得到UILable在设置字体样式后的真实长度
- .Net实现上传图片按比例自动缩小或放大的方法
- 图片缩小后按原来的比例显示
- 425_缩小TextView字体到两行
- js技术图片加载并按比例缩小到合适大小
- js+css图片自动等比例缩小且垂直居中[v20071208]
- 利用CSS按比例缩小图片
- 等比例缩小图片
- VC比例放大缩小
- //等比例缩小图片
- 按比例缩小图片
- 思路-按比例缩小坐标,利用四舍五入求最近相邻点