How to make the UITableView footer for a section not sticky
Possible duplicate:
TableView Footer scrolls with table
I want to have a footer for each section that is not sticky and will scroll with a table
- (UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section
This method defines the presentation for the footer, which is sticky.
Thank you in advance
source to share
Assuming you have a facility to tell you when you are at the end of the dataset for a specific section, why don't you just tag the custom UITableViewCell
one that appears as the section footer you want? It is very easy to write logic in tableView:cellForRowAtIndexPath:
that will check if a cell in the dataset is being requested for that particular section. Once the requested indexPath.row
is 1 more data available (usually contained in an array, so if indexPath.row is equal [array count]
), return the footer cell. This will scroll with the table as it scrolls, as it is just another cell. You can make it look like regular cells as you would like.
Also, you will need to tell your table view that there will be one extra row in each section, so if you say something like
return [array count];
Instead, you will need to say
return [array count] + 1;
in your numberOfRowsInSection method.
source to share