我有一个NSTabView,我在其标签上分配和加载相同的NSViewController:
IRCView *viewirc = [[IRCView alloc] initWithNibName:@"IRCView" bundle:nil];
for (id view in [tabsView tabViewItems]) {
[view setView:[viewirc view]];
}
如何在每个IRCView
标签上加载NSTabView
视图控制器的不同“实例”?因此,每个选项卡可以与IRC服务器(在此示例中)具有不同的连接
答案 0 :(得分:0)
for(NSTabViewItem * tabViewItem in [tabsView tabViewItems])
{
// instantiate a brand new IRCView for each tab view item...
IRCView *viewirc = [[IRCView alloc] initWithNibName:@"IRCView" bundle:nil];
// ... and do whatever customization you want to do for each IRCView here
[tabViewItem setView: viewirc];
[viewirc release]; // tabViewItem already retains
}