i try to get my head around view-based NSTableViews on OS X.
My Problem is that in the loaded view cell (NSView subclass) the subviews are not initialized when i try to assign the values in my delegate.
At the moment the correct count and the correct view is displayed, but i cannot access the subviews to assign the proper values.
What i have done so far:
- Created the xib with the custom view cell in Interface Builder.
- Created the custom class for the cell and assigned it in IB.
This work fine and i can see the properties in the Debugger. Correct class and the properties are IBOulets that are wired to the correct fields.
I can see the call to:
- (NSView *)tableView:(NSTableView *)tableView viewForTableColumn:(NSTableColumn *)tableColumn row:(NSInteger)row
In my NSViewController:awakeFromNib
i do:
// Make my view controller the delegate
_applicationTableView.delegate = self;
// set the correct datasource
_applicationTableView.dataSource = [NWDataHolder sharedInstance];
// register the nib with the custom cell
[_applicationTableView registerNib:cellNib forIdentifier:@"ApplicationListViewCell"];
In my - (NSView *)tableView:viewForTableColumn:row:
i do:
NWApplicationListViewCell *cell = [_applicationTableView makeViewWithIdentifier:@"ApplicationListViewCell" owner:self];
The correct class and cell is returned and i have access to the properties. The problem is, that subview is not initialized, the property is nil and the new value could not be set:
Log(@"Application Name Label %@", cell.applicationNameLabel); => nil
I`ve seen some hints that the subviews are initialized lazyly, but i cannot find a way to make the eager initialize.
Any suggestions what i'm doing wrong ?
Thanks, Oliver
NWApplicationListViewCell *cell = [_applicationTableView makeViewWithIdentifier:@"ApplicationListViewCell" owner:self];
. After this the subviews are still nil. – Odo