UITableView data not appearing in main view using GCD(Grand Central Dispatch)
i've done all the coding where i fetch data using XML and then show that
data on the UITableView, data is shown without using the GCD, but when i
add the UIActivityIndicator and used the gcd so the ActivityIndicator will
show until the all the data hasn't arrive.
here's my code:
[super viewDidLoad];
[self.activityIndicator startAnimating];
self.activityIndicator.hidesWhenStopped = YES;
dispatch_queue_t myQueue =
dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0);
dispatch_async(myQueue, ^ {
xmlParser = [[XMLParser
alloc]loadXMLByURL:@"http://www.irabwah.com/mobile/core.php?cat=0"];
[self.activityIndicator
performSelectorOnMainThread:@selector(stopAnimating)
withObject:nil waitUntilDone:YES];
});
No comments:
Post a Comment