Reputation: 26476
Why does the following code log 'Done' as soon as it is fired?
[UIView animateWithDuration:0.3
animations:^{
NSLog(@"Start");
}
completion:^(BOOL finished){
NSLog(@"done");
}
];
Upvotes: 2
Views: 1641
Reputation: 1714
Because you aren't animating anything. If you change the value of some UIView in your animation block, you will correctly see "done" outputted after the 0.3 second delay.
I tested with a 5 second delay using exactly your code, only adding in something to animate to confirm.
Upvotes: 3
Reputation: 4634
Because you're not actually animating anything (a NSLog cannot be animated). You need to animate an object or else the completion block will be called straight away. The 0.3 second duration will be ignored if there is nothing being animated.
Upvotes: 9