I want to start my UIActivityIndicator only if the action take too much time:
- (void) continueLaunch {
//operations
//.....
[activityIndic stopAnimating];
}
//my current method
- (void)lauchApplication {
[activityIndic startAnimating];
[self performSelector:@selector(continueLaunch) withObject:nil afterDelay:0.0f];
}
//what I want to do
- (void)lauchApplication {
if ([self performSelector:@selector(continueLaunch) withObject:nil afterDelay:0.0f]duration > 1 second){
[activityIndic startAnimating];
}
}
How can I do that ?
I think the best aproach is to start the Indicator after the duration you want to wait, and if in some moment before that duration something happens, you can cancel it:
And for cancel it (From Apple Doc):