页面过渡动画后更新当前页码

时间:2013-07-18 20:57:08

标签: iphone objective-c ios6

现在正在使用此声明翻转翻页时更新currentPagenumber

 [self displaycurrentIndex:currentIndex + 1];

以下方法。当页面尚未显示时,它会更新当前页面编号。所以这就是为什么要在页面过渡动画完成后更新它。

我希望它在转换动画完成时应该更新cureent页码。如何在页面转换动画完成后用代码编写来更新当前页面编号。

- (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;
}

感谢您的帮助。

1 个答案:

答案 0 :(得分:1)

UIPageViewControllerDelegate有以下方法:

pageViewController:didFinishAnimating:previousViewControllers:transitionCompleted:

将委托对象分配给UIPageViewController,并更新该方法中页码的显示。