现在使用此语句在翻页时更新 currentPagenumber
[self displaycurrentIndex:currentIndex + 1];
在下面的方法中。当页面尚未显示时,它会更新当前页码。所以这就是为什么要在页面过渡动画完成后更新它。
我希望它应该在过渡动画完成后更新当前页码。页面转换动画完成后,我如何编写代码来更新当前页码。
- (UIViewController *)pageViewController:(UIPageViewController *)pageViewController
viewControllerAfterViewController:(UIViewController *)viewController {
NSString *path = [[NSBundle mainBundle] pathForResource:@"pages" ofType:@"pdf"];
NSURL *pdfurl = [NSURL fileURLWithPath:path];
PDFDocument = CGPDFDocumentCreateWithURL((__bridge CFURLRef)pdfurl);
contentViewController = [[ContentViewController alloc] initWithPDFAtPath:path];
currentIndex = [modelArray indexOfObject:[(ContentViewController *)viewController page]];
if (currentIndex == totalPages - 1) {
return nil;
}
contentViewController.page = [modelArray objectAtIndex:currentIndex + 1];
[self displaycurrentIndex:currentIndex + 1];
return contentViewController;
}
感谢帮助。