Question

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).

Was it helpful?

Solution

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];
}
...
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top