1

I have a page controller that show a day planning with a UITableView inside

The main controller shows the day , and the page content shows the planning of that day. To change the page content it uses the "book effect" animation.

The problem is that, If you start the animation It pass throught viewControllerBeforeViewController or viewControllerAfterViewController and viewControllerAtIndex, but if the user decide to stay in the same day( the same content page) instead of finish the animation, The day label already changed since I changed it on viewControllerAtIndex

How can I know the real index , or How can I track the real index.

If you need further explanation ask me for them please

D4rWiNS
  • 2,585
  • 5
  • 32
  • 54
  • 1
    You need to use a different delegate method to update the index: see [this answer](http://stackoverflow.com/a/27934069/3985749) for details. – pbasdf Jan 15 '16 at 10:03

1 Answers1

0

Just declare an int on your class and add

- (void)pageViewController:(UIPageViewController *)pageViewController willTransitionToViewControllers:(NSArray *)pendingViewControllers{
         self.nextPageIndex = contenido.pageIndex;  
}

And then

- (void)pageViewController:(UIPageViewController *)pageViewController didFinishAnimating:(BOOL)finished previousViewControllers:(NSArray *)previousViewControllers transitionCompleted:(BOOL)completed {

if(completed){
    self.pageIndex = self.nextPageIndex;
}

}

D4rWiNS
  • 2,585
  • 5
  • 32
  • 54