Search code examples
iosobjective-cuistoryboarduistoryboardsegue

How to navigate a child view controller from other child view controller in objective c


I want to navigate to a view controller from another controller. Both view controllers are child of root view controller of navigation view controller. Now I want to navigate to a second view controller from the first view controller and same as first view controller from second view controller using navigation view controller. How to do that?

The Storyboard image is as follows :

enter image description here


Solution

  • you can just drag a segue from child1's button to child2, and child2's button to child1, though the storyboard will look ugly, but it works. or you can just use

    [self.navigationController pushViewController:child2 animated:YES];