开发者

How to hold for a moment in program?

开发者 https://www.devze.com 2023-03-21 18:58 出处:网络
I am fetching data from f开发者_如何学编程acebook and during the time of fetching the data, it is taking few milliseconds or a second. I want to be on hold untill fetched data perfectly.

I am fetching data from f开发者_如何学编程acebook and during the time of fetching the data, it is taking few milliseconds or a second. I want to be on hold untill fetched data perfectly.

How to write code for this?


- (void)viewDidLoad 
{
    [self performSelectorInBackground:@selector(startFatching) withObject:nil];
        [super viewDidLoad];
}
- (void) startFatching
{
    [self performSelectorOnMainThread:@selector(startIndicator) withObject:nil waitUntilDone:NO];

    NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; 

        // your code

       [self performSelectorOnMainThread:@selector(stopIndicator) withObject:nil waitUntilDone:NO];
[pool release];
}

- (void) startIndicator
{
    av.hidesWhenStopped = YES;
    [av startAnimating];
}

- (void) stoprIndicator
{
   [av stopAnimating];
}

hope this will give you some idea

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号