Search code examples
iosswiftuinavigationcontrollerpopup

how to handle popUp's next viewController to embed in navigation?


I have a tab bar, an every item of it embedded in navigation controller, and several child viewControllers! and I have a pop up view which I created in a new viewController!! to show my popUp I had to choose "present modally"! when I go to a new viewController from my popUp on pressing button, it's not embedded in my navigation controller! is there any way to fix it? and the new viewControl also stays embed in navigation to show my tab bar


Solution

  • Unfortunately, what you are trying to achieve is not right, and please do not proceed with your initial plan.

    I strongly believe a quick look at this could help you understand better UINavigationController and the difference between push vs present UIViewController in iOS.

    As an answer to your question, you can imitate your wanted behaviour, but there is no direct native iOS way to accomplished your goal. Better, use pushViewController:animated: instead of present. More in the apple dev site - here.