hey, Could any one guide me through this I have around 15 entries in table I would like another 15 to come up with the load more in last UITableViewCell. could anyone help me?
to show an extra row in the tableview, in
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
return dataRows+1;
}
In
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
//after setting tableviewcell
if(indexPath.row==dataRows){
cell.textLabel.text=@"Load More Rows";
}
}
In
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
if(indexPath.row==dataRows){
//there you can write code to get next rows
}
}
You need to update the numberOfRows variable according to the displayed rows.
Edit: After fetching the extra entries, you can add them to the existing entries array using the following method. Your original array should be a NSMutableArray
to use this method.
[originalEntriesArray addObjectsFromArray:extraEntriesArray];
I wrote an example project that does just this. Download it from GitHub https://github.com/Abizern/PartialTable
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With