ios - Use BWWalkthrough Library without Storyboard, Walkthrough Custom -


i'm using bwwalkthrough library personal walkthrough. simple implement have mistake bwwalkthroughviewcontroller: wont use storyboard create main controller i've created custom view via code , in viewdidload of bwwalkthroughviewcontroller ive setted view , pagecontrol. rest of code same of example in github repository.

that viewdidload of bwwalkthroughviewcontroller:

override func viewdidload() {     super.viewdidload()     let welcomeview: welcomeview = welcomeview() // custom view     view = welcomeview     self.pagecontrol = welcomeview.pagecontrol      ... } 

and, because first view, rootviewcontroller setted bwwalkthroughviewcontroller viewdidload modified. have func setting walkthrough in appdelegate.swift:

func showwelcomeview() -> bwwalkthroughviewcontroller{     let storyboard = uistoryboard(name: "welcome", bundle: nil)      let walkthrough: bwwalkthroughviewcontroller = bwwalkthroughviewcontroller()     let page_zero = storyboard.instantiateviewcontrollerwithidentifier("walk_0") as! uiviewcontroller     let page_one = storyboard.instantiateviewcontrollerwithidentifier("walk_1") as! uiviewcontroller     let page_two = storyboard.instantiateviewcontrollerwithidentifier("walk_2") as! uiviewcontroller     let page_three = storyboard.instantiateviewcontrollerwithidentifier("walk_3") as! uiviewcontroller     let page_four = storyboard.instantiateviewcontrollerwithidentifier("walk_4") as! uiviewcontroller      walkthrough.delegate = self     walkthrough.addviewcontroller(page_zero)     walkthrough.addviewcontroller(page_one)     walkthrough.addviewcontroller(page_two)     walkthrough.addviewcontroller(page_three)     walkthrough.addviewcontroller(page_four)         return walkthrough } 

im using func here:

func application(application: uiapplication, didfinishlaunchingwithoptions launchoptions: [nsobject: anyobject]?) -> bool {     // override point customization after application launch.       self.window = uiwindow(frame: uiscreen.mainscreen().bounds)     self.window?.rootviewcontroller = showwelcomeview() // func usedhere     return true } 

the app run without errors. can see custom view , 4 subviews(walk_0 ... walk_4) , can slide them no correctly: scrollable free , doesn't stop on each page.

so... i've missed step custom view? me please!

this screenshot iphone scroll positioned between 2 subviews:enter image description here

ive fixed using property of scrollview in bwwalkthroughviewcontroller

override func viewdidload() {     super.viewdidload()     ..      scrollview.pagingenabled = true } 

work fine, dunno why. default of scrollview pagingeenabled = true setted in init:

required init(coder adecoder: nscoder) {     // setup scrollview     scrollview = uiscrollview()     scrollview.showshorizontalscrollindicator = false     scrollview.showsverticalscrollindicator = false     scrollview.pagingenabled = true  // default of scrollview      // controllers empty array     controllers = array()      super.init(coder: adecoder) } 

Comments

Popular posts from this blog

c++ - Difference between pre and post decrement in recursive function argument -

php - Nothing but 'run(); ' when browsing to my local project, how do I fix this? -

php - How can I echo out this array? -