首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 移动开发 > 移动开发 >

UILable缩小字体比起例缩小_附加倒计时

2013-10-31 
UILable缩小字体同比例缩小_附加倒计时#import ViewController.h@interface ViewController (){NSIntege

UILable缩小字体同比例缩小_附加倒计时

#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

热点排行