In your code remove :
- (void)awakeFromNib
{
[super awakeFromNib];
[self createPages];
self.dataSource = self;
NSLog(@"Index = %lu", self.index);
[self setViewControllers:[NSArray arrayWithObject:self.pages[self.index]] direction:UIPageViewControllerNavigationDirectionForward animated:true completion:nil];
}
and replace it by :
- (void)viewWillAppear:(BOOL)animated
{
[super viewWillAppear:animated];
[self createPages];
self.dataSource = self;
NSLog(@"Index = %d", self.index);
[self setViewControllers:[NSArray arrayWithObject:self.pages[self.index]] direction:UIPageViewControllerNavigationDirectionForward animated:true completion:nil];
}