3

What is the best way to create a wizard using a storyboard?

For instance, after a user launches my app for the first time he/she should create a profile (name, nickname, gender, interests, etc). I want to do this in several steps (wizard). So in step 1,2,3 an user is able to fill in personal info. At step 4 there will be a 'finish' button. The moment that the person object is saved in core data should be when the user taps this button. But what is the best approach to do this? I created a Person class, which inherits from NSManagedObject

In the storyboard I created one navigation controller which is connected to a viewcontroller (step 1), this controller is connected with another viewcontroller (step2), and so on... Is it a good idea to create different view controller classes where everything is handled or should I use one which I should re-use?

Any tips how to do create a wizard in general? (in combination with core data)

joostevilghost
  • 149
  • 3
  • 7

1 Answers1

1

Option 1: Implement a main view controller (the first one) and then implement modal views off of that for addition information. You can use next buttons in your modal views, which can be setup to dismiss the modal view controller and return to the main view or call another modal view controller. The information you gather in the modal views should be communicated back to the main view with a delegate protocol. Only after you have all the information should you commit the information to core data. See this answer for information on setting up a delegate protocol.

Option 2: If you are performing the same function of gathering information you can stick with one view controller that presents different views. The views should have previous and next buttons. The last view should have a finished button. When finished button should commit the save to core data. You can layout all the views on top of one another inside a containerView and switch between them as I describe in the answer to this question.

Community
  • 1
  • 1
T.J.
  • 3,942
  • 2
  • 32
  • 40
  • 2
    Your comment is correct, but posting it 2 minutes after you posted you answer is a bit much. – jrturton Mar 12 '12 at 16:52
  • I would like to, but where can I find it? – joostevilghost Mar 12 '12 at 17:17
  • About your answer T.J. Isn't it better to use storyboard where it's made for. I am not sure putting views on top of each other is a good approach when you have thing like storyboards. Especially when they are complicated (e.g. with a tableview, scrollview, datepickers). I am not an expert though :) – joostevilghost Mar 12 '12 at 17:23
  • I didn't know that you has a number of different types of data input. I'll modify my answer to address that. PS: There is a checkmark to accept answers to the left of the answer. Press that when you are ready to accept an answer. I let new users know about the protocol because find many new users don't know. When I joined it took me a while to figure out, so don't be offended by the suggestion. – T.J. Mar 12 '12 at 18:31