I am using 3rd part UIActivityIndicator SVProgressHUD, I am initalising this when my view loads. I would like to delay the activityIndicator for about 1 second while a few things in my app happen. then call [SVProgressHUD dismiss]; based off that 1 second wait.. but am not sure how to do this.
currently this is how my code looks in viewdidload
[SVProgressHUD showWithMaskType:SVProgressHUDMaskTypeBlack];
[SVProgressHUD setStatus:@"loading..."];
[SVProgressHUD dismiss];
I know that there is a dismisswithsucsess:timer .. but this seems to delay the amount of time the sucsess message appears for which I don't want.. I want to delay the indicator and have no text.. but just cannot think of a way to do it.
I have tried
sleep(1); //which dosnt work
also I have tried
//[SVProgressHUD performSelector:@selector(stopAnimating) withObject:nil afterDelay:0];
and put [SVProgressHUD dismiss]; inside stopAnimating method but this falls over as it seems all of the calls need to be inside the same method.
You could use a timer to set of a method that dismisses your view like so:
[NSTimer scheduledTimerWithTimeInterval:1 target:self
selector:@selector(myMethod) userInfo:nil repeats:NO];
With method:
-(void)myMethod:(NSTimer*)timer {
// Dismiss your view
[progressthingy dismiss];
}