IOS 动画的两种方式

方式一:

[UIView animateWithDuration:1 animations:^{
        //动画的内容
        CGRect frame = CGRectMake([UIParam widthScreen]-25, 54, 0, 0);
        [self setFrame:frame];
        
        CGRect frame1 = CGRectMake(0, 0, 0, 0);
        
        [self setAnimationFrame:self frame:frame1];
        
    }completion:^(BOOL finished){
        if ([self.lockerDelegate respondsToSelector:@selector(animationFinished)]) {
            [self.lockerDelegate animationFinished];
        }
    }];
-(void)setAnimationFrame:(UIView*)view frame:(CGRect)rect{
    for (UIView *uv in view.subviews) {
        [uv setFrame:rect];
        
        [self setAnimationFrame:uv frame:rect];
    }
}

 方式二:

[UIView beginAnimations:nil context:nil];
            //设定动画持续时间
        [UIView setAnimationDuration:DurationTime];
            //动画的内容
        [self removeFromSuperview];
            //动画结束 
        [UIView commitAnimations];
原文地址:https://www.cnblogs.com/SimonGao/p/4613445.html