Possible Duplicate:
TableView Footer is scrolling with the table
I want to have a footer for each section that will not be sticky and would scroll with the table
- (UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section
This method defines a view for the footer that is “sticky”.
Thank you in advance
Assuming you have a means by which to know when you’re at the end of the data set for a particular section, why don’t you just tag on a custom
UITableViewCellthat appears as the section footer you want? It’s very simple to write the logic withintableView:cellForRowAtIndexPath:that would check if the cell being requested is within the data set for that particular section. As soon as theindexPath.rowbeing requested is 1 greater than the available data (generally contained in an array, so if indexPath.row is equal to[array count]), return your “footer” cell. This will scroll along with the table as it scrolls, since it’s just another cell. You can make it look as differently from the regular cells as you’d like.Additionally, you would need to tell your table view that each section will have one extra row, so if you’re saying something like
You would need to say, instead,
in your numberOfRowsInSection method.