【问题标题】:UIPageViewController Application - Populate with a pdfUIPageViewController 应用程序 - 使用 pdf 填充
【发布时间】:2011-12-26 14:21:58
【问题描述】:

我想填充此应用程序,但使用 pdf 而不是字符串。我能怎么做 ?我猜它在函数中 - (void)createContentPages ...非常感谢您的帮助。

这是使用的示例代码:

http://www.techotopia.com/index.php/An_Example_iOS_5_iPhone_UIPageViewController_Application

我更改了 createContentPages,但它确实很糟糕,我猜是正常的,它只显示图像的路径(我尝试使用图像,似乎更容易......):

- (void) createContentPages
{
    NSFileManager *filemgr;
    NSArray *filelist;
    int count;

    int j;
    j = 0;
    NSMutableArray *pageStrings = [[NSMutableArray alloc] init];

    filemgr = [NSFileManager defaultManager];
    filelist = [filemgr contentsOfDirectoryAtPath:[NSString stringWithFormat:@"%@/img", [[NSBundle mainBundle] bundlePath]] error:NULL];
    count = [filelist count];

    for (int i = 0; i < 3; i++)
    {
        NSString *path = [NSString stringWithFormat:@"%@/img/Diapositive", [[NSBundle mainBundle] bundlePath]];
        NSString *intString = [NSString stringWithFormat:@"%d", i];
        NSString *concatinatedString = [path stringByAppendingString:intString];

        NSString *final = [concatinatedString stringByAppendingString:@".png"];


        [pageStrings addObject: final]; 
    }
   pageContent = [[NSArray alloc] initWithArray:pageStrings];


}

【问题讨论】:

    标签: ipad ios5 xcode4.2 uipageviewcontroller


    【解决方案1】:

    在您引用的示例代码中,基本视图是 UIWebView,它将内容解释为 HTML。仅传递文件路径是行不通的。如果您想要内容,则必须将其包装在适当的 HTML 页面中。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-05-30
      • 1970-01-01
      • 1970-01-01
      • 2012-09-13
      • 2012-05-29
      • 2022-07-20
      相关资源
      最近更新 更多