tableView:numberOfRowsInSection: does not have to a fixed number. You can do something like this:
NSMutableArray *data
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
return [data count];
}
So when you have new items to be displayed, first add it your data array and then call [tableView reloadData]. You could get the data asynchronously but when adding it to your array and reloading the tableview, I would suggest doing it on the main thread or you might observe some strange behaviour. For infinite display of data I use this:
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
//Your cell code
if (indexPath.row>[data count]-5) {
[self getNewData];
}
}
Your get new data function will be called when you are near the end of your tableview. There you can append your array in any way you want. Also make sure to handle it so that the function isn't called multiple times in one go.