ios - Which is the preferred way of doing tutorial page with UIPageViewController in swift for first time entering App only -
i relatively new ios interface design, , facing problem:
i having app wanted have a tutorial (uipageviewcontroller) ahead of navigationcontroller, main controller on storyboard app enter with.
now, want achieve let app run my tutorial pages ahead first time of app running, enter navigationcontroller. if not first time, user go navigationcontroller directly.
after research, found out there @ least 2 ways of doing it:
- programming uipageviewcontroller totally on code, in appdelegate, having if-else loop this.
- insert uipageviewcontroller storyboard , it.
so far 2 ways can find out. second however, can't find optimal way handle "skipping tutorial page completely". or there better way of doing this. want app more optimal, , wondering usual way of doing ios professional's choice.
thank you!
(p.s. if question repeated 1 or not clear, please leave me comments. again! possible bonus if can show links github demo.)
the way sort of thing follows:
- put tutorial content in separate storyboard.
- in initial view controller of main storyboard, check dedicated variable in nsuserdefaults see if user has ever run app before.
- if not, programmatically load initial view controller of tutorial storyboard , present it.
this way, main storyboard isn't loaded bunch of view controllers used once, , there minimal code write transition.
-- edit --
below swift version of answer question: how can load storyboard programmatically class?
let storyboard = uistoryboard(name: "tutorial", bundle: nil) let viewcontroller = storyboard.instantiateinitialviewcontroller() presentviewcontroller(viewcontroller, animated: true, completion: nil)
Comments
Post a Comment