gpt4 book ai didi

cocoa - NSTableView + NSProgressIndicator 闪烁问题

转载 作者:行者123 更新时间:2023-12-03 16:37:06 25 4
gpt4 key购买 nike

我有一个 NSTableView,其中包含两列,每行一个 NSTextField 和一个 NSProgressIndicator 对象。当我向上或向下滚动 NSProgressIndicator 对象闪烁时,当我选择 NSTextField 中包含的文本时也会发生同样的情况。有谁知道为什么?

这是我用于在“viewForTableColumn”方法中创建 NSProgressIndicator 对象的代码:

... 
if ([identifier isEqualToString:@"Progress"]) {
NSProgressIndicator* progressIndicator = (NSProgressIndicator*)cellView.nextKeyView;
NSString *stringPercentage = [dictionary objectForKey:@"Percentage"];
[[progressIndicator animator] setDoubleValue:[stringPercentage doubleValue]];
}
...

注意:NSTextField 只能选择(不可编辑)。

最佳答案

我可以使用以下方法解决这个问题:[progressIndicator setUsesThreadedAnimation:NO];

所以最终的代码是:

... 
if ([identifier isEqualToString:@"Progress"]) {
NSProgressIndicator* progressIndicator = (NSProgressIndicator*)cellView.nextKeyView;
NSString *stringPercentage = [dictionary objectForKey:@"Percentage"];
[[progressIndicator animator] setDoubleValue:[stringPercentage doubleValue]];
[progressIndicator setUsesThreadedAnimation:NO];
}
...

关于cocoa - NSTableView + NSProgressIndicator 闪烁问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18142801/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com