階層データ構造を示すテーブルビューを使用しています。最初のノードを取得し、テーブルビューに子を表示して、ツリーの最後まで繰り返します。私はこのようにしています:
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
if([[actualNode getSonAtIndex:0] sonsCount]>0) {
NSLog(@"New level");
actualNode = [actualNode getSonAtIndex:indexPath.row];
[self.tableView reloadData];
} else {
NSLog(@"Service");
[self performSegueWithIdentifier:@"Service" sender:NULL];
}
正しい方法ではありませんが、問題は、ツリーがいくつのレベルにあるかわからないため、ストーリーボードで作成できないことです。アイデアは、各レベルを表示するためのTableViewを1つだけ作成することですが、そのようにすると、ストーリーボードでいくつかのコントローラーを操作していて、持っていない場合にできるように、NavBarの前のレベルに戻ることはできませんアニメーション。それで、それを行う方法はありますか?何かのようなもの:
MyNextLevel *nextlevel = [MyNextLevel alloc];
[nextlevel setNode: actualNode]
Myactualtableview = nextlevel; (Here the next level is showed in the screen with animations and with the possibility to go back to the previous level)
ありがとう。