NSTableView binding problem
- by Niklas Ottosson
I have only just started with XCode (v3.2.2) and Interface Builder and have run into a problem.
Here is what I have done:
I have made a class to be the datasource of a NSTableView:
@interface TimeObjectsDS : NSControl {
IBOutlet NSTableView * idTableView;
NSMutableArray * timeObjects;
}
@property (assign) NSMutableArray * timeObjects;
@property (assign) NSTableView * idTableView;
- (id) init;
- (void) dealloc;
- (void) addTimeObject: (TimeObj *)timeObject;
- (int) count;
// NSTableViewDataSource Protocol functions
- (int)numberOfRowsInTableView:(NSTableView *)tableView;
- (id)tableView:(NSTableView *)tableView
objectValueForTableColumn:(NSTableColumn *)tableColumn row:
(int)row;
I have then bound my NSTableView in the View to this datasource like so:
I have also bound the View NSTableView to the Model idTableView variable in Interface Builder seen above
In the init function I add a element to the mutable array. This is displayed correctly in the NSTableView when I run the application. However when I add another element to the array (of same type as in init) and try to call [idTableView reloadData] on the View nothing happens.
In fact the Model idTableView is null. When printing the variable with NSLog(@"idTableView: %@", idTableView) I get "idTableView: (null)"
Im runing out of ideas how to fix this. Any ideas to what I could do to fix the binding?