Reputation: 5101
I don't have now access to XCode to check my question, but I would like to know if it is possible the following scenario: A UITableView with sections, in some app situations I don't want to show a section (e.g section 0), but I need the section 0 rows to be taken into account to the rest of the tableView.
My question is, would there be problems with indexes, expected number of sections and/or expected number of rows, fetchedResultsController, etc., if I hide section 0 and its rows setting their heights to 0?
Thank you
Upvotes: 0
Views: 199
Reputation: 1097
Nothing will happen it will work fine. Because, we can hide a section or view what ever we need in tableview we have an advantage of showing no.of rows and no.of sections. Here we are hiding section0 by providing its height as 0 and at the same time if we want to hide its row also(rows of section 0) then we need to set height for row in section0 as 0.
Upvotes: 1
Reputation: 45500
I did that yesterday.
I used the following deleguate:
- (CGFloat)tableView:(UITableView *)tableView
heightForRowAtIndexPath:(NSIndexPath *)indexPath;
and I returned 0
like you said. It works perfect
Upvotes: 1