开发者

How to hold for a moment in program?

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜