0

I am developing an iOS app that I have already developed for Android.

The problem is I don't know how to organize my UIViewControllers considering the following scheme of my app pages:

enter image description here

The scheme is simple: there is a login page which leads to the main page. From this main page, there are four buttons which all lead to a specific view hierarchy but at the very bottom of each, the user will be able to go back directly to the main page. Each page accessed by the main page will also have a custom back button (an image of my own)

The question is: is there any benefit in using a UINavigationController (obviously with the main page as its root) in my case? Or can I simply create each Controller and using only Modal Segues?

Alaeddine
  • 6,104
  • 3
  • 28
  • 45
Kritias
  • 187
  • 1
  • 12
  • Check the following answer http://stackoverflow.com/questions/9392744/what-is-the-difference-between-modal-and-push-segue-in-storyboards – casillas Jul 14 '15 at 18:11

3 Answers3

1
  1. If your view controllers have a navigation relationship so using UINavigationController is the way to go:

In 'push' segue, you are basically pushing your ViewController into an already setup "navigation stack". Well, of course, this is under the assumption that the ViewController that performs the 'pushing' operation belongs to the same navigation stack as the ViewController is pushed into. Generally, you push a ViewController if the pushed ViewController has some sort of a relationship with the pushing ViewController. This is very common in applications that has a NavigationController in its system. A good example for a push segue is a system where you are displaying a list of contacts. And on tap of a particular contact, you are pushing a VC that has the corresponding details of the contact.

Example is real world: list of products => product details => product reviews

  1. If you want to temporary present a view controller and the main focus is your view controller but you need to present another view controller to perform a task like "filter" , "login", adjust "settings" then modal segue is the way to go

In 'modal' segue, there is no stack as such. You are presenting a VC 'modally' over the presentee VC, if that makes sense. This can happen across any ViewController without any relationship rules. The presenter should take care of dismissing the VC it presented. A good example for modal segue is login. On tap of login, you are modally presenting a VC that has no relationship with the presenter.

  1. If your view controllers are not related to each other, but each view controller has his own navigation stack then UITabBarController is the way to go

Storyboards (Xcode): What is the difference between a push and modal segue?

Alaeddine
  • 6,104
  • 3
  • 28
  • 45
0

I would say if each of the additional view controllers from the main "home" view controller don't have any children view controllers, then you can just have each button present a view controller modally.

The main difference is if you are using a navigation controller, you can "pushing" a vc onto the navigation stack of view controllers, whereas presenting it modally can be thought of a "one time" action where the user does something on the new screen and has no where to advance to logically (like adding information to a new contact).

You can see this post for a more detailed answer:

What is the difference between Modal and Push segue in Storyboards?

Community
  • 1
  • 1
royherma
  • 4,095
  • 1
  • 31
  • 42
  • Each additional VC from the main page will have a back button and another button to present the next VC in the hierarchy. (Except for the last one which has to allow the user to go back to the main page directly without seeing the previous pages again). Some of these VC will use a UITableViewController. Do you think presenting each VC modally is appropriate? (I have already read the link you provided but I think that doesn't answer my question) – Kritias Jul 14 '15 at 18:24
0

Deciding whether to use a Modal segue vs a Show (push) depends entirely on purpose and context of the user's experience. If you are leading the user down a path which is linear, where each successive VC is diving deeper in to a singular idea, then use Show segues and NavigationControllers. Examples include, Settings app, where you can drill into all the specifics. Most e-commerce app will use a NavigationController to lead the user through a purchase.

If you want to present the user with a single concept, which the user can respond to, or close it to continue using the rest of the app. Then use a modal presentation. Adding a contact in the iPhone is a fine example of this.

Visually, the difference is that a Show segue presents the VC from the right side of the app, sliding onto the previous VC. (If the user has Arabic language turned on, a right to left language, the Show segue will come from the left hand side of the VC) A modal comes from the bottom of the app.

From looking at your drawing, but not know anything else about your app, I think you want to use NavigationControllers. You may also want to consider a TabBarController. If each of these buttons lead the user on various ways of using the app, like mini apps within one big one, then a TabBarController is appropriate.