我有一个分段的表格视图,其中部分的数量和行数是动态的。数据从不同的数组和字典提供给每一行。我想在调用didSelectRowAtIndexPath
. 我遵循了这个答案,但给出了错误的结果。我想应该有一种方法来获得线性计数......
问问题
416 次
1 回答
0
我找到了解决方案:在- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
我添加:
NSString *numberOfRowsInSectionString = [[NSString alloc]initWithFormat:@"Section%i",section];
[numberOsRowsArray addObject:numberOfRowsInSectionString];
当我需要知道我所在的行数时:
NSString *currentSectionString = [[NSString alloc]initWithFormat:@"Section%i",indexPath.section];
[numberOsRowsArray sortUsingSelector:@selector(compare:)];
NSUInteger indexOfTheObject = [numberOsRowsArray indexOfObject:currentSectionString]+indexPath.row;
于 2013-03-12T17:44:54.250 回答