Creating ViewController only works for the first time that the application is running iOS

advertisements

I am working on an application and I want to implement a tutorial that would run the firs time the application is run on the Phone. I have already setup NSUserDefaults and can successfully determine and flag the application once it is run for the first time. My problem now is moving from the Tutorial View Controller to the main view controller.

My current set up has the main view controller set as the root controller to my app and my tutorial view controller needs to be shown and then dismissed only the first time the app is run.

What's the best method for implementing it? I was thinking of showing it as a Modal view and have the main view controller show it if it detects the first run. Any suggestions?

Note that I am not using Storyboards


I would go with your approach of presenting a modal on top of your root view controller when you detect first launch.

Use presentViewController:animated:completion: to display it, with animated: set to NO. That way it will appear on top of the root view controller and cover it. Then when you're done with the first view controller you can dismiss it and reveal your root view controller underneath.