Search code examples
xcodecocoadrawingnstableviewnssplitview

NSTableView displaying incorrectly in NSSplitView


I have an NStableView embedded in an NSSplitview. The table will display, but when it does, the first three or so rows are not visible until I reize the window and/or split view. Then, it will snap into place and function perfectly fine until I quit.

Has this ever happened to anyone? Is there a simple method I can call on the view or table to get it to redraw?

This is how it displays when the view is first loaded (note: the user can scroll the table up and see the top row highlighted, but never get to it)

bad nstableview display after resizing the window, the table view suddenly snaps into place and appears as it should:

correct nstableview display


Solution

  • I actually got this working by calling the subview and then just resetting the position of the splitview divider.

    NSView *v = [vc view];
    [self.superDisplayView addSubview:v];
    [self.SourceListSplitView setPosition:250 ofDividerAtIndex:0];