Blocks are a feature of the C language that have been added to the iPhone and iPad sdk with iOS 4.
What they allow you to do are create usable “blocks” of code that you can pass along like any object. This probably sounds a lot like a function, and they are very similar, but there is a significant difference in that they “close” around variables that are in scope before a block is declared.
I know this sounds odd, and you might be wondering when you’ll need to use them, but they certainly have their uses as there are definitely times when you will want a small block of reusable code.
You can find a complete tutorial from Mike Clark here that explains things better here:
Using Blocks In iOS 4
If you liked this, please share it!
[Via Joost Schuur]
©2010 iPhone iOS 4 iPad SDK Development Tutorials, Programming Tips, News. All Rights Reserved.
.
Share and Enjoy: