Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Endless UITableview Section

I have a table view with one section. I pull the data down from the internet in small chunks asynchronously in the background. The problem I have is I don't know how many records there will be in total. When the web service stops returning data I know I have them all, in some cases the rows might be infinite.

The method:

-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section

is understandably called once at the beginning of view load, at this point I don't know how big my section is going to be. Any ideas on how best to approach this problem? Can I set the section size anywhere after this method has been called?

like image 320
Magpie Avatar asked Feb 26 '23 09:02

Magpie


1 Answers

You can make the tableview reload it's data, call

[tableView reloadData];

...and it will ask the datasource about number of rows etc again.

like image 137
epatel Avatar answered Mar 06 '23 14:03

epatel