0
Have a Page in my application that works with Uipageviewcontroller, in it I implement the Uipageviewcontrollerdatasource. So I have a list of items that are listed in various views, the problem is that when I update this list, the items work perfectly, I can navigate all items, including new ones. The problem is that Bounce (bottom balls) are the old value, IE, if it had 5 pages before and now 6 continues 5 balls. I did not find in the documentation any command that updates this information. Below is part of my class that deals with Uipageviewcontrollerdatasource.
func loadPageView() {
self.pageViewController = self.storyboard?.instantiateViewControllerWithIdentifier("PageViewController") as! UIPageViewController;
self.pageViewController.dataSource = self;
self.pageViewController.delegate = self;
let startVc = self.viewControllerAtIndex(0) as ContentViewController;
let viewsControllers : [ContentViewController] = [startVc];
self.pageViewController.setViewControllers(viewsControllers, direction: .Forward, animated: true, completion: nil);
self.pageViewController.view.frame = CGRectMake(0, 30, self.view.frame.width , self.view.frame.size.height - 70);
self.addChildViewController(self.pageViewController);
self.view.addSubview(self.pageViewController.view);
self.pageViewController.didMoveToParentViewController(self);
}
func viewControllerAtIndex(index: Int) -> ContentViewController {
if((ExercicioDataSource.listaExercicios.count == 0) || (index >= ExercicioDataSource.listaExercicios.count)){
return ContentViewController();
}
let vc : ContentViewController = self.storyboard?.instantiateViewControllerWithIdentifier("ContentViewController") as! ContentViewController;
vc.dataContent = ExercicioDataSource.listaExercicios[index];
vc.index = index;
return vc;
}
// UI Page View Data Source
func pageViewController(pageViewController: UIPageViewController, viewControllerBeforeViewController viewController: UIViewController) -> UIViewController? {
let vc = viewController as! ContentViewController;
var index = vc.index as Int;
if(index == 0 || index == NSNotFound){
return nil;
}
index -= 1;
return self.viewControllerAtIndex(index);
}
func pageViewController(pageViewController: UIPageViewController, viewControllerAfterViewController viewController: UIViewController) -> UIViewController? {
let vc = viewController as! ContentViewController;
var index = vc.index as Int;
if(index == NSNotFound){
return nil;
}
index += 1;
if(index == ExercicioDataSource.listaExercicios.count){
return nil;
}
return self.viewControllerAtIndex(index);
}
func presentationCountForPageViewController(pageViewController: UIPageViewController) -> Int {
return ExercicioDataSource.listaExercicios.count;
}
func presentationIndexForPageViewController(pageViewController: UIPageViewController) -> Int {
return 0;
}