Sidharth J Dev
Sidharth J Dev

Reputation: 987

I need to delay the call of UITableView until other methods have finished executing

I am building an ios app, that uses google places api to locate certain places and then display the details in a table view. But the problem, that I am facing is that

-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView

method gets called before the data acquired from the api is stored in the memory. So it (obviously) returns 0, and details are not displayed. Is there some way I can delay the call of Table View?

Upvotes: 0

Views: 98

Answers (3)

Rory McKinnel
Rory McKinnel

Reputation: 8014

Well your only option is to not show the table view until there is data there.

Assuming this is not viable, why not just show an activity popup indicating that you are loading information and then when its loaded, drop the activity indicator and call [self.tableview reloadData];

Upvotes: 3

bseh
bseh

Reputation: 467

You can make the tableview invisible and make it visible right before reloading the table.

Upvotes: 0

DilumN
DilumN

Reputation: 2895

You can reload your Table by below line,

[tableView reloadData];

Upvotes: 0

Related Questions