您的位置:首页 > 移动开发 > IOS开发

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];

                         }

                     ];

}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息