Sven Kaufmann
Sven Kaufmann

Reputation: 11

Hierarchical master-detail app with xcode

I'm searching any tutorial or explication how to add a "level" in a table-view.

I'm using XCode 4.3.2. I've created a Master-Detail App, and I did all what I should for a working application. But I have only one Level in my table view, and have absolutely no idea how to get a second level.

I searched a lot in Google and in the Apple documentation, but I haven't found anything..

My wish is to have the list, when you click on an object of the list, you go to the second level with a new list, and when you click on an object of the second list, it changes the Detail View.

Upvotes: 1

Views: 1810

Answers (1)

Paul Peelen
Paul Peelen

Reputation: 10329

I think what you mean is going to the next view controller. What you should do is use the delegate method - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath (Link to doc)

Here you can create a new tableViewController, e.g.

UITableViewController *newTable = [[UITableViewController alloc] initWithStyle:UITableViewStylePlain];
[self.navigationController pushViewController:newTable animated:YES];

However, what you want to do (I guess) is send data to it which is should show. So, in your newTable tableviewcontroller you should create a new init method which allows you to send in the data you need. For instance an array. The class can then handle that data and show it as you please.

I hope that answered your question.

Upvotes: 3

Related Questions