第13月第13天 iOS 放大消失动画

1.

- (void) animate
{
    [UIView animateWithDuration:0.9 animations:^{
    
        CGAffineTransform transform = CGAffineTransformMakeScale(2.5, 2.5);
        self.countdownLabel.transform = transform;
        self.countdownLabel.alpha = 0;
        
    } completion:^(BOOL finished) {
        if (finished) {
            
             if (self.currentCountdownValue == 0) {
                 [self stop];
                 if (self.delegate) {
                     [self.delegate countdownFinished:self];
                     [self removeFromSuperview];
                 }
                 
             } else {

                self.countdownLabel.transform = CGAffineTransformIdentity;
                self.countdownLabel.alpha = 1.0;
                
                self.currentCountdownValue--;
                if (self.currentCountdownValue == 0) {
                    self.countdownLabel.text = self.finishText;
                } else {
                    self.countdownLabel.text = [NSString stringWithFormat:@"%d", self.currentCountdownValue ];
                }
            }
        }
    }];
}

 

https://github.com/simpliflow/SFCountdownView

 

posted @ 2017-10-13 10:59  lianhuaren  阅读(302)  评论(0编辑  收藏  举报