动画块 - 完成立即触发

Ben*_*ard 2 animation uiviewcontroller uiview ios

为什么下面的代码一旦被触发就会记录'完成'?

[UIView animateWithDuration:0.3 
                 animations:^{
                        NSLog(@"Start");
                 } 
                 completion:^(BOOL finished){
                     NSLog(@"done");
                 }
 ];
Run Code Online (Sandbox Code Playgroud)

W D*_*son 8

因为你实际上并没有动画任何东西(NSLog不能动画).您需要为对象设置动画,否则将立即调用完成块.如果没有动画,则将忽略0.3秒的持续时间.