How to offer custom code for Cocoa to invoke or communicate with

  1. Subclass and then override specific methods with custom behaviour
  2. Apply protocol and implement corresponding methods or functionality
  3. Via Notification mechanism, registering for interested notification, unregistering before gone.
  4. Using Timer
  5. Using delegation
  6. As data source
  7. Using Target-Action or Nil-Target-Action
  8. Via KVC and KVO. KVO is a notification mechanism that doesn’t use the NSNotification Centre. It allows one object to be registered directly with a second object so as to be notified when a value in the second object change.


  1. KVC, KVO, Introspection or some dynamic features (respondForSelector or so) are implemented in Objective-C runtime that access via NSObject method or Objective-C runtime programming.
  2. All custom class is an object whose type is Class that is a subclass of NSObject.
  3. An object has an isa pointer which points to its class object. And inside the object, there are a block of memory storing its properties and the isa pointer. When that object invokes a instance method, the runtime will use its isa pointer to find out which class object is that object’s class then call the method with that object’s address (object pointer) and resting parameters. And the class object has a property called super pointing to its superclass object and has an isa pointer pointing to Class object as well which is the class of class. That’s sort of implementation detail of Objective-C runtime.