Search code examples
iosobjective-cstoryboardxib

How to set segue doing pop to root and push a new one in storyboard?


I want to make a segue that makes navigation controller poptoroot and then make a new controller pushed into the navigation controller . e.g Now the controller hierarchy is

 navigationController->rootcontroller->controllerA ->controllerB

and i want to make a segue perfome in controller B,and the segue will make the hierarchy to

navigationController->rootcontroller-> controllerC

is this possible?


Solution

  • You want to set segue doing pop to root. This can be achieved using Unwind Segues. For more detail regarding this you can follow this Apple doc.

    https://developer.apple.com/library/content/technotes/tn2298/_index.html#//apple_ref/doc/uid/DTS40013591-CH1-TNTAG2-ADDING_AN_UNWIND_SEGUE_TO_A_STORYBOARD

    For pushing to new VC, You can simply push in storyboard.