I would like to have a spinner animation(a custom imageset not the default) in some NSCell
s inside an NSTableView
. I was able to achieve this by using an object that calculates the correct image and I force update the affected cells to get about 25-30 fps. I'm pretty sure that this is not the way it should work as it will consume a lot of CPU. Any suggestions how to do this more effectively?
I do this in the didSelectRowAtIndexPath delegate method so when the user touches a cell it adds a spinner to the accessoryView on the right.
UITableViewCell *cell = [tableView cellForRowAtIndexPath:indexPath];
UIActivityIndicatorView *activityView =
[[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhiteLarge];
[activityView startAnimating];
[cell setAccessoryView:activityView];
[[NSRunLoop currentRunLoop] runUntilDate: [NSDate dateWithTimeIntervalSinceNow:0.01]];
*Note this is for iOS but I assume its very similar for OSX
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.