Here is a discussion of the blocks from my book:
http://www.apeth.com/iOSBook/ch03.html#_blocks
Here is an example, but here is an example that is closer to what you are asking:
[self transitionFromViewController:fromvc toViewController:tovc duration:0.4 options:UIViewAnimationOptionTransitionFlipFromLeft animations:nil completion:^(BOOL done){ [tovc didMoveToParentViewController:self]; [fromvc removeFromParentViewController]; }];
The completion block accepts one parameter, BOOL is called "done", but this is not used by its code. The idea is that the animation is executed, and then the code is executed in the completion block.
It is very important to be comfortable with the blocks, because they are the way of the future. For example, viewing animations in iOS 4 uses them, as described in the "Block Based Animation" section of my book (first read about the old method, then read about the new iOS 4 method):
http://www.apeth.com/iOSBook/ch17.html#_view_animation
In iOS 5, blocks are even more important; more and more situations where they are not optional.
Blocks are also a way to use GCD (grand central scheduling), which is far and far the best way to do multi-threading.
source share