I am working on a Mac application. One of the windows can load several NSView objects that are in the same NIB / XIB file.
But my code looks like this:
@interface TheWindowController : NSWindowController {
IBOutlet NSTableView *detailsTree;
IBOutlet NSView *bigView;
IBOutlet NSView *subView1;
IBOutlet NSView *subView2;
IBOutlet NSView *subView3;
IBOutlet NSView *subView4;
IBOutlet NSView *subView5;
}
My question is, can all of these IBOutlets be held inside an array, dictionary, or something similar. So in the future, I could do something like this in my implementation:
- (IBAction)traceTableViewClick:(id)sender {
[[[bigView subviews] objectAtIndex:0] removeFromSuperview];
[rightView addSubview: [subviewsArray objectAtIndex:[detailsTree selectedRow]]];
}
Is it possible? How? Any examples?
source
share