What is the recommended practice for creating tab view with multiple tabs. Should I use single XIB file for all the views or have different XIB per views? my preference is to use multiple controllers for each view in the tab view and hence different xib files. How can I achieve it?
Is it possible to have multiple views in a single xib file for each tab view, each having different controllers?
What is the recommended practice for creating tab view with multiple tabs. Should I
Share
Are the tabs always the same, or are they dynamic? If they’re always the same, I tend to use a single xib file, just because it’s easy. You can still use multiple controller objects — just make them subclasses of
NSObject, and drop them all into the same xib.I did do a quick Google to see if there was an easy way to use
NSViewControllers with tab views, and I found this thread. That contains some sample code for how to use them, which would give you a separate controller class and xib per tab. Obviously, I haven’t tried that code, so I can’t vouch for it, but it might be a good enough start. (In that sample code, it instantiates a new view controller each time you switch tabs, which probably isn’t what you want — if it were me, I’d instantiate them the first time a tab was swapped to, and then keep them in a dictionary in the window controller, and on subsequent switches then just pull out the respective view controller that already exists.)