I am going to make a tableview with 2 sections inside it. I can add cells to every section programmatically and when i add, i scroll to the end of tableview using
[_tableView setContentOffset:CGPointMake(0, CGFLOAT_MAX)];
My question is how can i scroll to the end of the section 0, so that when user add a cell to section 0, tableview scroll dynamically to the last cell in section 0.
thanks.
You can try with this code:
int yourSection = 2;
int lastRow = [tableView numberOfRowsInSection:yourSection] - 1;
[tableView scrollToRowAtIndexPath:[NSIndexPath lastRow inSection:yourSection] atScrollPosition:UITableViewScrollPositionBottom animated:YES];
You get the numbers of rows in your section, then scroll to that indexPath.