【问题标题】:Simple pdf viewer using UIPageViewController使用 UIPageViewController 的简单 pdf 查看器
【发布时间】:2013-03-31 15:30:01
【问题描述】:

我有问题。 我正在尝试制作一个简单的应用程序来查看带有UIPageViewController 的 pdf,但我无法让它工作。

我尝试使用下面 github 页面上列出的项目。

https://github.com/jackhumphries/UIPageViewController-PDF

但我习惯使用StoryBoards,但我无法使用StoryBoards

我用以下代码创建了一个按钮:

NSString *path = [[NSBundle mainBundle] pathForResource:@"mhm" ofType:@"pdf"];
PageViewController *page = [[PageViewController alloc] initWithPDFAtPath:path];
[self presentViewController:page animated:YES completion:NULL];

我收到以下错误:

Undefined symbols for architecture armv7:
  "_OBJC_CLASS_$_PageViewController", referenced from:
      objc-class-ref in PDFPageViewController.o
ld: symbol(s) not found for architecture armv7
clang: error: linker command failed with exit code 1 (use -v to see invocation)

当我删除最后两行时,我的项目正在运行,但您可以想象我的 pdf 没有显示出来。

我尝试在情节提要中创建单独的视图,但无法正常工作。

【问题讨论】:

  • 您是否将 QuartzCore 框架添加到您的应用项目中?
  • @JonathanD 是的,我做到了,我只是按照 github 页面的所有步骤进行操作。它可以在没有情节提要的情况下工作,但在有情节提要的情况下,它就可以使用。你有想法吗?是最后两行造成的

标签: ios xcode pdf storyboard uipageviewcontroller


【解决方案1】:
NSString *path = [[NSBundle mainBundle] pathForResource:@"mhm" ofType:@"pdf"];
    UIPageViewController *page = [[UIPageViewController alloc] initWithPDFAtPath:path];
    [self presentViewController:page animated:YES completion:nil];

试试这个

【讨论】:

  • UIPageViewController 是通用的,它用于将一组视图控制器显示为一本书。当然,它不包含直接获取 PDF 的方法。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2011-06-30
  • 2015-09-27
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多