Search code examples
iosobjective-cios7

What are limitations of presentViewController over UINavigationController


I am confused about "In which situations we have to use presentViewController and UINavigationController". I had read so many documents, but I haven't found accurate explanation. We can always use UInavigationController then what is the use of presentViewController ?

Thanks.


Solution

  • You can't push a navigation controller into other navigation controller. You can present a navigation controller above other navigation controller.

    If you push a view controller into the navigation controller, view controller's view cover only area inside navigation controller. If you present a view controller, view controller's view cover the window hierarchy (user can't interact with other parts of the application).

    You can don't use UINavigationController to present some UIViewController. You should care about "close" button to let user to close presented UIViewController

    I've create test project to illustrate my answer https://github.com/K-Be/PresentTest