Reputation: 5807
My first screen that contains a uitableview, I used to call webservice method in viewdidload:
- (void)viewDidLoad {
[super viewDidLoad];
self.navigationItem.title =@"Brand List";
getBrands *obj = [[getBrands alloc]init];
[obj getBrandsList];
getBrandsList, but before the webservice finished, it loads the screen, so the screen contains an empty list.
So I need to wait (ie. loading dialog) until the method completes and then show the screen with data.
How do I do this?
Upvotes: 0
Views: 325
Reputation: 5807
-(IBAction) buttonClick: (id) sender{
//show loading dialog here(activity indicator)
[self performSelectorInBackground:@selector(callWebService) withObject:nil];
}
-(void) callWebService
{
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc]init];
//resend request and parse response.
// create new view controller object and push screen
// hide loading indicator
[pool release];
}
Upvotes: 0
Reputation: 12036
Create an new View with an UIActivityIndicatorView and an UILabel. Then add it on top of your window with some CATransition. When you finish download remove this screen.
Upvotes: 2