- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
Directory *aDirectory = [appDelegate.directories objectAtIndex:indexPath.row];
_XMLDetailsView.aDirectory = aDirectory;
if (indexPath.section == 0) // First section
{
_XMLDetailsView.aDirectory = aDirectory;
}
else if(indexPath.section == 1) // Second Section
{
Directory *aDirectory = [appDelegate.directories objectAtIndex:indexPath.row +[listOfItems count]];
_XMLDetailsView.aDirectory = aDirectory;
}
else if(indexPath.section == 2) // Third Section
{
Directory *aDirectory = [appDelegate.directories objectAtIndex:indexPath.row +[listOfItems count] +3];
_XMLDetailsView.aDirectory = aDirectory;
}
else if(indexPath.section == 3) // Fourth Section
{
Directory *aDirectory = [appDelegate.directories objectAtIndex:indexPath.row +[listOfItems count] +9];
_XMLDetailsView.aDirectory = aDirectory;
}
}
这是从某个部分选择某行值的正确方法吗?因为当我为例如“C”部分做选择行时索引路径时,假设显示从数组 (4) 开始的值。但在 "C" 部分,它再次显示来自 array(0) 的值。我被困了这么久,有人有任何建议或帮助吗?