Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What describes the "File's Owner" best in objective-c / cocoa Nib?

Unfortunately, the explanation of File's Owner is pretty short at the Apple docs. I know it is an proxy object. But what's really the point about that "File's Owner" object? What is it good for?

like image 813
Thanks Avatar asked Feb 28 '09 14:02

Thanks


People also ask

What is file's owner in Xcode?

The File owner is the object that loads the nib, i.e. that object which receives the message loadNibNamed: or initWithNibName: . If you want to access any objects in the nib after loading it, you can set an outlet in the file owner.

What's a nib file?

A nib file is a special type of resource file that you use to store the user interfaces of iOS and Mac apps. A nib file is an Interface Builder document.


1 Answers

Nib files are often referred to as "freeze dried" and ready to run, and they are a great way of making your apps more modular which can reduce memory usage. Nib files can be defrosted, or loaded into memory anytime when the app needs the objects inside it.

Whenever a nib file is defrosted, it needs a pointer to the object that defrosted it. And that object is usually, the File's owner. The File's owner allows objects inside the nib file to access objects that existed before the nib file was defrosted. In a way, the File's owner acts as a bridge between newly loaded objects and old objects.

like image 84
Earl Claridad Avatar answered Oct 11 '22 20:10

Earl Claridad