R – When do I not need to specify File’s Owner for a nib

cocoainterface-builderiphoneobjective c

I have been reading up on File's Owner here on Stack Overflow and a few other resources, but I was left with one question. When do I not need a File's Owner for a nib? In chapter 8 of Exploring the iPhone SDK (a great book by the way) you design a table view cell nib. The author says the following:

You might be wondering why we're not doing anything with the File's Owner icon. The reason is that we just don't need to. We're using this table cell to display data, but all the interaction with the user is going to go through the table view, so it doesn't need its own controller class. We're really just using the nib as a sort of template so we can design our table cells visually.

This does not make sense to me. I was under the impression that all nib files needed a File's Owner, but obviously my understanding of this concept is not complete. Can someone restate when and why I don't need to worry about File's Owner?

Best Answer

Going by what you quoted, the book says that your File's Owner is using the objects in the nib, but the objects in the nib are not using File's Owner, so you don't really need to configure File's Owner at all in IB.

You always have a File's Owner, because something is loading the nib, and that something is the File's Owner.

More to the point, even if the objects in the nib are not using the FO now, you may change them later to do so, so you might as well configure the FO every time.

Configuring the FO in IB also makes accessing the objects in the nib easier. Once you tell IB what class the FO is, you can create outlet variables in your header, and IB will detect them automatically; then you can connect those outlets in IB and access the objects by those outlet variables in your code.