I have only recently started learning cocoa so as a warning upfront I'm pretty unfamiliar and uncomfortable with it at the moment. I apologize if I miss anything blatantly simple. :/
I've been following a tutorial for learning how to use NSTableView bit by bit, I finally got one working, however now I want to get it working with a custom cell. I subclassed NSTableCellView (which just for temporary reference I'm calling MyCell) and created a new xib etc...
I though that with the code I have so far from the tutorial, I could just change the class in the populating code and have it at least change which cell is being used, however I still get the exact same result even if I change all references to MyClass instead of NSTableCellView. Nothing that I've added to the xib for the new class shows up at all, instead it runs 100% identical to the NSTableCellView.
What am I missing or not understanding here? This is the code that populates the table:
After changing all of the NSTableCellView portions to the MyCell subclass still it works 100% the same as before, with none of the buttons etc... that I add to the new xib.
I've been following a tutorial for learning how to use NSTableView bit by bit, I finally got one working, however now I want to get it working with a custom cell. I subclassed NSTableCellView (which just for temporary reference I'm calling MyCell) and created a new xib etc...
I though that with the code I have so far from the tutorial, I could just change the class in the populating code and have it at least change which cell is being used, however I still get the exact same result even if I change all references to MyClass instead of NSTableCellView. Nothing that I've added to the xib for the new class shows up at all, instead it runs 100% identical to the NSTableCellView.
What am I missing or not understanding here? This is the code that populates the table:
Code:
-(NSView *)tableView:(NSTableView *)tableView viewForTableColumn:(NSTableColumn *)tableColumn row:(NSInteger)row {
NSDictionary *flag = _tableContents[row];
NSString *identifier = [tableColumn identifier];
if ([identifier isEqualToString:@"MainCell"]) {
NSTableCellView *cellView = [tableView makeViewWithIdentifier:@"MainCell" owner:self];
[cellView.textField setStringValue:flag[@"name"]];
[cellView.imageView setImage:flag[@"image"]];
return cellView;
}
return nil;
}
After changing all of the NSTableCellView portions to the MyCell subclass still it works 100% the same as before, with none of the buttons etc... that I add to the new xib.