Quote:
Originally Posted by Shake0615
Well, I'm not familiar with how XIBs work. But I figured it would cost more memory to create and store the information about a button in a XIB file (I imagine it keeps all the objects in memory from beginning to end) as opposed to creating it in Xcode using NSButton and cleaning it up once I'm done with it.
If there is a difference between the two methods, I was hoping to know how marked that difference was. If there isn't, then I guess my question is pointless lol.
|
Nib files aren't stored in memory; they're files, so they're stored in the filesystem. Applications load nib files at runtime as needed by unarchiving their contents, which causes the objects to be allocated dynamically, just as they would if you were creating them programmatically.
The difference is that the objects loaded from a nib file already have some or all of the properties set, which in some cases can save writing and maintaining a fair amount of relatively boring code. Once the objects are in memory they're the same as any other objects, and their lifetimes will be determined by what your code does, just as with objects you allocate in code. There should be no difference in memory consumption.