Search code examples
iosuitableviewuiviewcontrolleruinavigationcontrollermaster-detail

Adding a 3rd View to Master-Detail Application


I want to create a Master-Detail Application which contains 3 Views in a master-detail hierarchy.

First View=>Second View=>Third View

When I create a Master-Detail Project, XCode creates two ViewControllers; a Master View controller and a Detail View Controller... I want to add a third ViewController to project and open this new View from a TableView in DetailView Controller.

I am little confused about this, I added a new UIViewController class to my project but I can't understand how I create a relationship between my new view and DetailView Controller?


Solution

  • If you would like to use DetailController -> YOur next Controller you can use it like this

    Open your storyboard and add there a view controller Set an unique title to this view controller - U can find this option under like shield icon in the right menu. Set the title whatever you want (lets say my_detailed_controller)

    And then in case you want to go from the detail view controller to the further more detailed controller you call this snippet :

    UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"MainStoryboard" bundle: nil];
    YOURVIEWCONTROLLER *lvc = [storyboard instantiateViewControllerWithIdentifier:@"my_detailed_controller"];
    [self.navigationController pushViewController:lvc animated:YES];