Get Updates By E-mail 

Subscriber Counter
Article Written By:
Johann Dowa

Blocks – An Interesting Objective-C Addition In iOS 4

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
Designing With Blocks

If you liked this, please share it!

[Via Joost Schuur]

Submit A Resource

Have you created a useful tutorial, library or tool for iOS development that you would like to get in front of our 300,000+ monthly page views from iOS developers?

You can submit the url here.

The resources we feel will appeal to our readers the most will be posted on the front page.

Comments