Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions ExpandableTableView/Control/ExpandableTableView.m
Original file line number Diff line number Diff line change
Expand Up @@ -360,6 +360,24 @@ - (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInte
#pragma mark -
#pragma mark UITableViewDelegateMethods

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
if ([_expandedSectionIndexes containsIndex:indexPath.section] && indexPath.row != 0) {
if ([_expandableDelegate respondsToSelector:@selector(tableView:heightForRowAtIndexPath:)]) {
return [_expandableDelegate tableView:self heightForRowAtIndexPath:[NSIndexPath indexPathForRow:indexPath.row - 1 inSection:indexPath.section]];
}
} else if (indexPath.row == 0 && _ungroupSingleElement && [_expandableDataSource tableView:self numberOfRowsInSection:indexPath.section] == 1) {
if ([_expandableDelegate respondsToSelector:@selector(tableView:heightForRowAtIndexPath:)]) {
return [_expandableDelegate tableView:self heightForRowAtIndexPath:indexPath];
}
} else {
if ([_expandableDelegate respondsToSelector:@selector(tableView:heightForSection:)]) {
return [_expandableDelegate tableView:self heightForSection:indexPath.section];
}
}

return tableView.rowHeight;
}

- (NSInteger)tableView:(UITableView *)tableView indentationLevelForRowAtIndexPath:(NSIndexPath *)indexPath {
//[_expandableDelegate tableView:<#(UITableView *)#> indentationLevelForRowAtIndexPath:<#(NSIndexPath *)#>
if (indexPath.row != 0 && [_expandedSectionIndexes containsIndex:indexPath.section]) {
Expand Down
4 changes: 2 additions & 2 deletions ExpandableTableView/Control/ExpandableTableViewDelegate.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@

- (BOOL)tableView:(ExpandableTableView *)tableView canRemoveSection:(NSUInteger)section;

//- (CGFloat)tableView:(ExpandableTableView *)tableView heightForSection:(NSUInteger)section;
//- (CGFloat)tableView:(ExpandableTableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath;
- (CGFloat)tableView:(ExpandableTableView *)tableView heightForSection:(NSUInteger)section;
- (CGFloat)tableView:(ExpandableTableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath;
- (NSInteger)tableView:(ExpandableTableView *)tableView indentationLevelForRowAtIndexPath:(NSIndexPath *)indexPath;
- (void)tableView:(ExpandableTableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath;
- (void)tableView:(ExpandableTableView *)tableView willDisplayCell:(UITableViewCell *)cell forSection:(NSUInteger)section;
Expand Down