高Sierra更新导致NSTableView翻转和打乱 [英] High Sierra update causes NSTableView to flip and scramble

查看:110
本文介绍了高Sierra更新导致NSTableView翻转和打乱的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在更新一个现有的项目,该项目在High Sierra方面已经运行了好几年.视图正确加载并看起来像往常一样:

I'm updating an existing project which has worked fine for years to High Sierra. The view loads correctly and looks as it always has:

然后,当我打开一个弹出窗口并再次将其关闭后,该视图会四处移动,翻转东西,并且通常看起来非常疯狂:

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

请注意,信息"标题下降到底部,左侧文本项反转,日期和下拉文本翻转.发生这种情况时,鼠标的交互似乎也非常混乱.

Notice the Info title drops to the bottom, the left side text items reverse order, and the date and dropdown text flip. Mouse interaction seems very scrambled as well when this happens.

我不确定从哪里开始解决这个问题,任何人都有任何想法吗?

I'm not sure where to even start with solving this one, anyone have any ideas?

这使用的是xcode 9 beta 5和High Sierra Beta6.
更新:在xcode 9 GM和High Sierra GM种子中也有

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

更新

当我在此视图所在的NSTableView上调用reloadData时,我确定会发生这种情况.因此,现在的问题似乎是如何刷新表数据而不会使其变得不稳定.

I have determined this happens when I call reloadData on the NSTableView that this view is within. So the question now seems to be how to refresh the table data without it going wonky.

推荐答案

似乎reloadData以及reloadDataForRowIndexes:columnIndexes:在High Sierra中都产生奇怪的行为.我的解决方法如下:

It seems that reloadData and also reloadDataForRowIndexes:columnIndexes: both produce odd behavior in High Sierra. My way around this is as follows:

-(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];
}

如果有更好的答案,我仍然很乐意看到它.

If there is a better answer I would still love to see it.

这篇关于高Sierra更新导致NSTableView翻转和打乱的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆