ナビゲーションバーにpdfの総ページ数を表示したい
- (void)viewDidLoad
 {
[super viewDidLoad];
NSString *path = [[NSBundle mainBundle] pathForResource:@"pages" ofType:@"pdf"];
totalPages = (int)CGPDFDocumentGetNumberOfPages(path);
PageViewController *page = [[PageViewController alloc] initWithPDFAtPath:path];
page.view.frame = self.view.bounds;
[self.view addSubview:page.view];
[self addChildViewController:page];
 [self displaycurrentIndex:1];
}
- (void) displaycurrentIndex:(NSUInteger)currentIndex {
self.navigationItem.title = [NSString stringWithFormat:
                                              @"Page %u of %u",
                                              currentIndex,
                                              totalPages];
  }
しかし、ナビゲーション バーでは 1 of 0 と表示されます。
一方、pdfの合計ページの1つである必要があります。
編集:
私はこのような URL ステートメントを使用していません
 CFURLRef pdfURL = CFBundleCopyResourceURL(CFBundleGetMainBundle(), CFSTR("paper.pdf"), NULL, NULL);
    pdf = CGPDFDocumentCreateWithURL((CFURLRef)pdfURL);
私の場合、使用しています
 NSString *path = [[NSBundle mainBundle] pathForResource:@"pages" ofType:@"pdf"];
そのため、pdf の総ページ数を取得できません。私のケースを使用して、pdf の総ページ数を取得するにはどうすればよいですか。
ありがとう