I've already searched for the problem, and the only hint was the performSelectorOnMainThread solution. I did that, but the view is not updating while the for loop is running. After the loop the progress value is displayed correctly – but that's not the point of an "Progress" View =)
The for loop is within a controller. I call a method to set the progress value:
CGFloat pr = 0.5; // this value is calculated
[self performSelectorOnMainThread:@selector(loadingProgress:) withObject:[NSNumber numberWithFloat:pr] waitUntilDone:NO];
And this is the loading progress method
-(void)loadingProgress:(NSNumber *)nProgress{
NSLog(@"Set Progress to: %@", nProgress);
[[self progress] setProgress:[nProgress floatValue]];
}
I also tried to put the method with the for loop into a background thread by using this at the top of the method:
if([NSThread isMainThread]) {
[self performSelectorInBackground:@selector(importData) withObject:nil];
return;
}
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
Maybe somebody can help me with this.