I would like to take my users through a help wizard if it’s the first time they are using my app. My plan was to lookup the user defaults for a certain key. My question is what’s the best way of re-routing the initial view in an iPhone app ? Does it happen in the app delegate ?
Do I have to have a reroute in my first view controller? Should I call the setRootView in my initial view’s navigation controller? Is it done in the storyboard?
I am very confused and was wondering if there is a good way of doing so ?
I use IOS 5
Thanks so much,
Ross
When using a userdefaults key on the first launch, its a good idea to override the initialize function in the AppDelegate. This will ensure that the user defaults key gets initialized to the correct value. For example, in one of my apps I am chaging to see if it is the first launch because I wan to display a welcome view controller to the user. I set this up using the following function in the AppDelegate.m file.
In the
– application:didFinishLaunchingWithOptions:I add a view controller as the root view controller. I like to always include a solid “Root View Controller” to do any sort of launch view switching. Doing it on the UIWindow subview level can be problematic. In RootViewController’s– viewDidLoadis where I check the user defaults for the key.All this is tied back to a Bool YES/NO switch in the settings.bundle which allows the user to see the WelcomeController again if they want.