Is the loading order of top level objects in a nib file random or can it be determined? I thought it would load the objects in the order I put them in in Interface Builder. But that doesn’t seem to always be the case.
I wanted to create an inspector view similar to Interface Builder, where the different sections have alternating background colors. I planned to do this by ordering the sections as top level views in my nib and then color them according to the loading order.
According to the documentation, the loading order is undefined:
See https://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/LoadingResources/CocoaNibs/CocoaNibs.html
And regardless, relying on something like the loading order to determine the visual layout seems like a very non-robust idea. I would instead use an NSTableView / UITableView, which will do the layout, alternating row colors, etc. all for you. (On Mac, you probably want a view-based table view). If you need a custom solution for some reason, load and add the views dynamically in code where you have full control over their order and position in the parent.