High Sierra update forces NSTableView to flip and cross

I am updating an existing project that has worked great for High Sierra for many years. The view loads correctly and looks as always:

Normal (correct) appearance

Then, after I open the popup and close it again, the view moves things, turns things around and, as a rule, looks very crazy:

Scrambled (incorrect) appearance

Notice that the Info heading goes down to the bottom, the text elements on the left side are reversed, and the date and drop-down text are flipped. Mouse interaction seems to be very scrambled when this happens.

I'm not sure where to start with this solution, who has any ideas?

This is using xcode 9 beta 5 and High Sierra Beta 6.
Update: this is also in xcode 9 GM and High Sierra GM Seed

Update

, , reloadData NSTableView, . , , , .

+4
7

, reloadData, reloadDataForRowIndexes: columnIndexes: High Sierra. :

-(void)refreshAllCells {
    NSMutableIndexSet* rowIndexes = [[NSMutableIndexSet alloc] init];
    if (self.myTable.numberOfRows != 0)
        [rowIndexes addIndexesInRange:NSMakeRange(0, (self.myTable.numberOfRows))];
    [self.myTable removeRowsAtIndexes:rowIndexes withAnimation:NO];
    [self.myTable insertRowsAtIndexes:rowIndexes withAnimation:NO];
}

, .

+2

requireUpdateLayer .

override open var wantsUpdateLayer: Bool { return true }

+1

IB , CALayers tableView. tableView, !

, , IB-:

Interface Builder options

+1

10.13, 10.12 . , , [layout]:

- (void)layout{
    if([self needsLayout]){
        for(NSView* v in [[self subviews] copy]){
            [self addSubview:v];
        }
    }

    [super layout];
}
0

. , WHILE, Tableview. , .

draw, . , OP, .

0

, , . macOS Mojave.

( ) autoSave NSTableView:

//Swift.print("Now setting autosaveName of primaryView to \(self.className).primary")
//primaryTableView.autosaveName = "\(self.className).primary"
//primaryTableView.autosaveTableColumns = true

. . , , tableView.autosaveName = "autosavename"; autoSave , " " ( xib). ..

Xcode (10.1 10B61), macOS Mojava 10.14.0 - 10.14.2. . High Sierra Mojave, .

, , , . , MacOS Mojave.

0

, - , :

, reloadData , reloadData . .

"" tableView.makeView(withIdentifier: identifier, owner: self) tableView(_:, viewFor:, row:). owner: self awakeFromNib() , , , reloadData(). () XIB , , , .

So the solution was to change tableView.makeView(withIdentifier: identifier, owner: self)to tableView.makeView(withIdentifier: identifier, owner: nil), and also use separate XIB for table cells.

0
source

Source: https://habr.com/ru/post/1686402/


All Articles