Custom NSTableViewCell is not aligned when is displayed in the NSTableView

135 views Asked by At

I made a custom NSTableCellView. I created my own custom NIB file, which the root view class is assigned to my CustomTableCellView class.

The XIB file hierarchy is as follows: enter image description here

Then, during the awakeFromNib I register my custom NSTableCellView:

[_table registerNib:[[NSNib alloc] initWithNibNamed:@"CustomTableCellView" bundle:nil] forIdentifier:@"CustomCellView"];

And during -[NSTableView tableView:viewForTableColumn:row:] I return my custom cell view like this:

CustomTableCellView *cellView = (CustomTableCellView *)[_table makeViewWithIdentifier:@"CustomTableCellView" owner:self];

return cellView;

But once the table view is displayed, I don't see the cell view properly aligned. I always see the cell like this:

enter image description here

Where you can see in the top right corner that the buttons are there but misaligned.

What do I need to do to properly center the other cell view with the one that has the Test text?

0

There are 0 answers