Mc-
Mc-

Reputation: 4056

Custom NSView for NSTableView not updating components

I created a custom NSView for a NSTableView.

I am trying to fill the fields I created in it using the Interface Builder but I can't. I would say each component is properly linked and the code is OK.

This is the function

- (NSView *)tableView:(NSTableView *)tableView viewForTableColumn:(NSTableColumn *)tableColumn row:(NSInteger)row
{
    Account *account = (Account *)[self.dataSource objectAtIndex:row];

    AccountTableCellViewController *controller = [[AccountTableCellViewController alloc] init];
    controller.subtitleLabel.stringValue = account.name;
    [controller.titleLabel setStringValue:account.num];
    NSLog(@"%@", controller.titleLabel);
    return [controller view];
}

And here is the picture of the bindings:

enter image description here

The table shows all the rows correctly, but is not filling the NSTextFields as expected.

UPDATE:

This is how it looks like (not updating views): enter image description here

Any suggestion?

Upvotes: 0

Views: 351

Answers (1)

TheAmateurProgrammer
TheAmateurProgrammer

Reputation: 9392

The labels haven't been loaded from the nib yet. I'd just create an extra account instance variable in your view controller, assign it there, then load the information in -(void)awakeFromNib

Upvotes: 1

Related Questions