Get Updates By E-mail 

Article Written By:
Johann Dowa

Tutorial: Instance Variables In Objective-C Categories

  •  
  •  
  •  
  •  
  •  

Categories in Objective-C are very useful allowing you to add methods to existing classes without the need to extend those classes. This is extremely useful – but what if you needed to add an instance variable to the class?

With associative references it is possible to fake instance variables in your Objective-C categories thus making categories a much more useful feature.

Ole Begemann has written a tutorial demonstrating this functionality by demonstrating this principle with a UIView category.

You can find the tutorial on his website here:
Faking Instance Variables In Obj-C Categories

A very useful tip which can make for some much cleaner code.


  •  
  •  
  •  
  •  
  •  

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