문제

I have a NSTableView which contains two columns, a NSTextField and a NSProgressIndicator object on each row. When I scroll up or down the NSProgressIndicator objects flicker, the same occurs when I select the text contained in the NSTextField. Does anyone know why?

This is the code I am using for creating the NSProgressIndicator objects in the 'viewForTableColumn' method:

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

Note: NSTextField's are only selectable (not editable).

도움이 되었습니까?

해결책

I could fix this by using: [progressIndicator setUsesThreadedAnimation:NO];

So that the final code is:

... 
if ([identifier isEqualToString:@"Progress"]) {
   NSProgressIndicator* progressIndicator = (NSProgressIndicator*)cellView.nextKeyView;
   NSString *stringPercentage  = [dictionary objectForKey:@"Percentage"];
   [[progressIndicator animator] setDoubleValue:[stringPercentage doubleValue]];
   [progressIndicator setUsesThreadedAnimation:NO];
}
...
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top