ios - UIPageControl skips over page when swiped? -


currently have uipagecontroller , appears skipping on screen when swiped. it's strange because put print line statements in when vc in use , looks moves right vc before going next vc in same swipe. (ie. goes step2 , goes step3 during same swipe) here how it's set up:

     var maxpages : int!      var currentindex : int = 0      var  listofviews = ["step1", "step2", "step3", "step4"]   //maxpages = listofviews.count in viewdidload         public func pageviewcontroller(_ pageviewcontroller: uipageviewcontroller, viewcontrollerafter viewcontroller: uiviewcontroller) -> uiviewcontroller? {          var index : int = (viewcontroller.view as? bgmwelcomepageview)!.index          index += 1          if (index == maxpages)         {             index = 0         }           return self.getviewcontrollerwithimage(index)     }      public func pageviewcontroller(_ pageviewcontroller: uipageviewcontroller, viewcontrollerbefore viewcontroller: uiviewcontroller) -> uiviewcontroller? {          var index : int = (viewcontroller.view as? bgmwelcomepageview)!.index          index -= 1          if (index < 0)         {             index = maxpages - 1         }  //this function called corresponding view controller    func getviewcontrollerwithimage(_ index: int) -> uiviewcontroller     {          var vc : uiviewcontroller         let loopcount = 999//(index < self.maxpages - 1) ? 1 : 99         switch listofviews[index] {         case "step1":             vc =  self.buildviewcontrollerwithimage(titlestring: "first_screen_title".localized, descriptionstring: "first_screen_description".localized, backgroundimage: "fractal_blue", jsonfile: "welcome_step_01_v01", index: index, loopcount: loopcount)              print("xxxx current listview: step1 xxxx")         case "step2":             vc =  self.buildviewcontrollerwithimage(titlestring: "second_screen_title".localized, descriptionstring: "second_screen_description".localized, backgroundimage: "fractal_blue", jsonfile:                 "welcome_step_02_v01", index: index, loopcount: loopcount)             print("xxxx current listview: step2 xxxxx")          case "step3":             vc =  self.buildviewcontrollerwithimage(titlestring: "third_screen_title".localized, descriptionstring: "third_screen_description".localized, backgroundimage: "fractal_blue", jsonfile: "welcome_step_03_v01", index: index, loopcount: loopcount)             print("xxxxx current listview: step3 xxxxxx")          case "step4":             vc =  self.buildviewcontrollerwithimage(titlestring: "fourth_screen_title".localized, descriptionstring: "fourth_screen_description".localized, backgroundimage: "fractal_blue", jsonfile: "welcome_step_04_v01", index: index, loopcount: loopcount)             print("xxxxxx current listview: step4 xxxxxx")          default:             vc =  self.buildviewcontrollerwithimage(titlestring: "first_screen_title".localized, descriptionstring: "", backgroundimage: "fractal_blue", jsonfile: "welcome_step_01_v01", index: index, loopcount: loopcount)                 print("xxxxx current listview: default xxxxxx")         }         self.currentindex = index      //print("xxxxx current index: \(self.currentindex) xxxxxxx")         return vc     } 


Comments

Popular posts from this blog

node.js - Node js - Trying to send POST request, but it is not loading javascript content -

javascript - Replicate keyboard event with html button -

javascript - Web audio api 5.1 surround example not working in firefox -