- (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" に対して didSelectRowAtIndexpath を実行すると、配列 (4) から始まる値が表示されると想定されるためです。ただし、代わりにセクション "C" に、array(0) からの値が再度表示されます。私はこれに長い間立ち往生しています。何か提案や助けがある人はいますか?