1

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.

Mogsdad
  • 44,709
  • 21
  • 151
  • 275
C.Johns
  • 10,185
  • 20
  • 102
  • 156

1 Answers1

10

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];  
}
Wesley
  • 2,190
  • 17
  • 26
  • I edited the post, so you know how your method should look like – Wesley Nov 04 '11 at 00:56
  • 1
    yup, its just they have a timer restricting me on accepting within a certain period of time.. so I went and had lunch and came back and marked it for you :) cheers again! – C.Johns Nov 04 '11 at 01:22