Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What's purpose of embedding in Navigation Controller?

I have been recently learning iOS development and a friend tells me that it's good practice to embed views in Navigation Controllers. Is that true and if so why?

What does embedding a View Controller in a Navigation Controller change versus just leaving a View Controller alone?

like image 494
William Bing Hua Avatar asked Oct 23 '14 02:10

William Bing Hua


1 Answers

… it's good practice to embed views in Navigation Controllers. Is that true and if so why?

It depends on what you're looking for. Embedding your main view in a view controller gives you some benefits.

  1. It provides an easy way to present and dismiss child view controllers that is very familiar to users.
  2. The navigation bar built into the navigation controller provides good structure: it gives you a place for a title and a tab bar for action buttons.
  3. It handles status bar spacing for you: this can be a pain for apps which still support iOS 6.

What does embedding a View Controller in a Navigation Controller change versus just leaving a View Controller alone?

  1. The navigation controller provides your app with the navigation bar.
  2. The navigation controller provides an easy way to show new view controllers (push) which has a built in UI for users to dismiss the view (back button).
like image 192
Jeffery Thomas Avatar answered Oct 08 '22 16:10

Jeffery Thomas