Answer the question
In order to leave comments, you need to log in
How to implement progress movements in NSProgressIndicator?
How to properly implement progress movement in NSProgressIndicator (determinate)?
Now I have implemented it like this:
IBOutlet NSProgressIndicator *progressIndicator;
NSFileManager *fileManager = [NSFileManager defaultManager];
NSArray *content = [fileManager contentsOfDirectoryAtURL:url includingPropertiesForKeys:nil options:NSDirectoryEnumerationSkipsHiddenFiles error:nil];
double countList = (double)[content count];
[progressIndicator setIndeterminate:NO];
[progressIndicator setMinValue:0.0];
[progressIndicator setMaxValue:countList];
[progressIndicator setDoubleValue:0.0];
for (NSURL *u in content) {
Element *e = ;
[list addObject:e];
[progressIndicator incrementBy:1.0];
}
Answer the question
In order to leave comments, you need to log in
Try to solve mathematically: Take the approximate amount of data, for example 50 files per 100% (max scale level) = X and consider the increment as a division: X% 50 (your degree of smoothness). Getting the amount of data to send in a separate thread:
NSOperationQueue *queue = [[NSOperationQueue alloc] init];
NSOperation *loadObj = [[NSInvocationOperation alloc]
initWithTarget:self
selector:@selector(loadInBackground:)
object:yourObj];
[queue addOperation:loadObj];
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question