After clicking on a cell it doesn't expand. The issue is reported on github. The issue occurs only for iOS 7. On previous versions everything works fine.
Asked
Active
Viewed 591 times
0
-
1This is off-topic because it's not a question. – Kreiri Oct 14 '13 at 08:06
-
2I faced a problem and did not find any solution. I have decided to post here an issue and my solution, because many people start their search from Stack Overflow – Sviatoslav Yakymiv Oct 14 '13 at 13:55
1 Answers
14
The issue is that expanded index paths are stored in NSDictionary
, where NSIndexPath
is key.
In iOS 7 method -(CGFloat)tableView:heightForRowAtIndexPath:
receives UIMutableIndexPath
object instead of NSIndexPath
object. So value from dictionary can't be retrieved.
Here is this method in SDNestedTableViewController.m:
- (CGFloat) tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
int amt = [[subItemsAmt objectForKey:indexPath] intValue];
BOOL isExpanded = [[expandedIndexes objectForKey:indexPath] boolValue];
if(isExpanded)
{
return [SDGroupCell getHeight] + [SDGroupCell getsubCellHeight]*amt + 1;
}
return [SDGroupCell getHeight];
}
The simplest solution is create some key that will have values from indexPath
. And will be member of NSIndexPath
class. So I've changed this method in following way:
- (CGFloat) tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
NSIndexPath *indexPathKey = [NSIndexPath indexPathForRow:indexPath.row inSection:indexPath.section];
int amt = [[subItemsAmt objectForKey:indexPathKey] intValue];
BOOL isExpanded = [[expandedIndexes objectForKey:indexPathKey] boolValue];
if(isExpanded)
{
return [SDGroupCell getHeight] + [SDGroupCell getsubCellHeight]*amt + 1;
}
return [SDGroupCell getHeight];
}

Sviatoslav Yakymiv
- 7,887
- 2
- 23
- 43