Category Archives: Objective-C

Mediator design pattern in CocoaTouch

The CocoaTouch UI framework has its own built-in implementation of the Mediator design pattern, named NSNotificationCenter. You can use an instance of the NSNotificationCenter class to broadcast notifications to any objects that are interested in that particular event. Several components in … Continue reading

Posted in CocoaTouch, Objective-C | 7 Comments

Anonymous categories to the rescue

One of the things about Objective-C that seems a bit archaic to me is methods must be declared before they are called by other methods in the same code file. If you don’t, the compiler emits warnings. This is a … Continue reading

Posted in Objective-C | 3 Comments

Categories in Objective-C

Objective-C has a feature called “categories” that allows you to extend the API of a type. It’s somewhat similar to extension methods in C# in that you can define methods which can be invoked on an instance of some class you … Continue reading

Posted in Objective-C | 7 Comments

Messages and methods in Objective-C

After experimenting with Objective-C for a while now, I find the language is gradually growing on me.  It’s still a bit strange in some spots, and I have a lot left to learn, but it’s starting to make sense.  One … Continue reading

Posted in Objective-C | 7 Comments

Dissecting an NSArray

Objective-C is based on good old C.  It also has support for object oriented programming, such as classes, virtual methods, and lots of the goodies I’m accustomed to using in C#. One of the classes included in the Foundation library … Continue reading

Posted in Objective-C | 11 Comments