windsound
windsound

Reputation: 666

Which is the preferred way of doing tutorial page with UIPageViewController in swift for first time entering App only

I am relatively new to IOS interface design, and currently facing this problem:

I am having an app wanted to have a tutorial (UIPageViewController) ahead of the navigationcontroller, which will be the main controller on storyboard that the app will enter with.

Now, what I want to achieve is let the app run my Tutorial Pages ahead for first time of app running, then enter the NavigationController. If it is not the first time, user will go to NavigationController directly.

After some research, I found out there are at least two ways of doing it:

  1. Programming the UIPageViewController totally on code, then in Appdelegate, having an if-else loop to do this.
  2. Insert the UIPageViewController into the storyboard and do it.

So far those are two ways I can find out. For second however, I can't find an optimal way to handle "skipping the tutorial page completely". Or probably there is a better way of doing this. I want the app to be more optimal, and wondering what is the usual way of doing it for an IOS professional's choice.

Thank you!

(p.s. If the question is a repeated one or not clear, please leave me comments. Thanks again! It is possible bonus for if can show some links for github demo.)

Upvotes: 1

Views: 835

Answers (2)

Daniel T.
Daniel T.

Reputation: 33967

The way I normally do this sort of thing is as follows:

  1. Put the tutorial content in a separate storyboard.
  2. In the initial view controller of the main storyboard, check a dedicated variable in the NSUserDefaults to see if user has ever run the app before.
  3. If not, then programmatically load up the initial view controller of the tutorial storyboard and present it.

This way, the main storyboard isn't loaded up with a bunch of view controllers that are only used once, and there is minimal code to write for the transition.

-- EDIT --

Below is a Swift version of the answer to this question: How can I load storyboard programmatically from class?

let storyboard = UIStoryboard(name: "Tutorial", bundle: nil)
let viewController = storyboard.instantiateInitialViewController()
presentViewController(viewController, animated: true, completion: nil)

Upvotes: 5

Shivani Gor
Shivani Gor

Reputation: 329

this link has sample project for that but it is written in Objective-C. https://github.com/MatthewYork/MYBlurIntroductionView

Upvotes: 1

Related Questions