PDA

View Full Version : NSObject and NSObjectController




Sergio10
Mar 29, 2009, 07:31 PM
Hi,

What is the difference between NSObject and NSObjectController?

http://pic.ipicture.ru/uploads/090330/MMWku84Rvd.png

Thanks,
Sergio



larkost
Mar 30, 2009, 01:15 AM
In InterfaceBuilder a NSObject item is tied to a single instance of an object and will instantiate that object when the nib is being awoken, whereas a NSObjectController is more of a generic pointer at an object of a certain type. NSObjectControllers do not cause anything to be instantiated just by being in a nib, but point at nil unless tied to something.

A way of illustrating this is when you have a an NSObjectController pointing at a NSArrayController pointing at "selectedObject". When the selected object changes that NSObjectController now points at a different object, but the objects themselves have not changed.