0

I have a NSTableView that I would like to show with rows as a staircase. I have succeeded, like you can see in this picture:

NSTableView with custom rows

I used this code to reach the result, in my table view delegate:

- (void)tableView:(NSTableView *)tableView didAddRowView:(NSTableRowView *)rowView forRow:(NSInteger)row
{

    NSPoint myOrigin = rowView.frame.origin;

   [rowView setFrameOrigin:NSMakePoint(myOrigin.x + 16,
                                    myOrigin.y)];

    NSArray *mySubViews = [rowView subviews];

    if (mySubViews != NULL)
        if ([mySubViews count] != 0)
        {
            NSTableCellView *myView = [mySubViews objectAtIndex:0];

            myOrigin = myView.frame.origin;

            [myView setFrameOrigin:NSMakePoint(myOrigin.x + (12 * row),
                                                        myOrigin.y)];
        }


}

The problem is, when I resize the NSSplitView that contains the two tables, if I shrink the view with the staircase table, it resets to default:

Problem

Does anybody have another method to achieve a similar result or a solution to the resizing problem using my method ?

Thanks a lot

Alfonso Tesauro
  • 1,730
  • 13
  • 21

0 Answers0