Segue type to be used for a user registration proc

2019-09-07 00:24发布

问题:

This is my first ios app & I have a user registration process which is separated out into 3 screens. The first screen has user to enter his mobile number, the second screen asks him select his location & the third screen asks him to enter his birthday and a few other details.

So in total, there are totally 3 controllers which I have used.

1) mobile_number_controller.rb 2) location_controller.rb 3) miscellaneous_details_controller.rb

Each detail the user enters is validated and is stored into the NSUserDefaults. If the validation fails then the user is not allowed to move to the next screen. Also, once the user enters his details correctly, then the user does not have a back button to go back to the previous screen as well.

I would like to know which is the type of segue to be used here. Should I embed these controllers in a navigation controller and use a push segue, or should I be using a modal segue?

Update regarding the chain of controllers.

I don't intend to take the user back to any presenting controller at any stage. Also, in most code I have read till now, for modal segues, I have seen the presented controller being dismissed or there's an unwind segue to go back to the presented controller. I am a bit confused on what to do with these presented controller here before presenting the next controller in the series?

Also, as I mentioned that I store whatever data has been entered by the user in NSUserDefaults, theres no need for the presenting controller to know about the data entered in the presented controller. Hence I don't feel the need for an unwind segue( like in the 'new contacts' application).

Any help on this would be much appreciated.

回答1:

I would use a series of modal segues (presented view controller). This is not a "user can go forward and back among views" situation: you are in total control of what the user sees. It is perfectly legal to present a view controller on top of a presented view controller. Moreover, it is simple to control how far back you take the user, e.g. go back all the way (dismissing all the views), if that's what you want to do.



回答2:

I would prefer a modal segue to present a navigation controller and push segues to connect the other view controllers. Similar to webapps a user perhaps want to step back to change previously entered information.