I have a Void. This void do something really slow, so at the beginning of Void I put an alert, and in the end I put another warning. Like here:
-(void)action {
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Start" message:@"Start." delegate:self cancelButtonTitle:@"Ok." otherButtonTitles:nil];
[alerta show];
[alert release];
//Something really slow
UIAlertView *alertEnd = [[UIAlertView alloc] initWithTitle:@"End" message:@"End." delegate:self cancelButtonTitle:@"Ok." otherButtonTitles:nil];
[alertEnd show];
[alertEnd release];
}
But when I run this code, the alerts are only shown at the end of the Void, after all the slow action.
How can I fix this?
First of all: try to avoid using many alerts since it’s not humane to you users. Show UIActivityIndicator instead.
If you must, then try this code for showing the first alert: