I have some code as shown below:
- (IBAction)startButtonPressed:(id)sender {
statusText.text = @"Processing...";
//here I do a bunch of calculations
//display calculated data
statusText.text = [[NSString alloc] initWithFormat:@"coefficient: %.4f",
[[coefficientEstimatesR objectAtIndex:0] doubleValue]];
}
The calculations that I do take about 17s, so I’d like to display the word “processing” while this is being done. However, when I run this, “processing” is never displayed, only the calculated data is displayed.
Any ideas on how to do this would be appreciated.
Thanks!
Do not do any processing in the GUI thread, not when it takes one second, and especially not when it takes 17 seconds. Using GCD makes offloading the task trivial: