1

我想填充此应用程序,但使用 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];


}
4

1 回答 1

1

In the sample code you are citing, the base view is a UIWebView, which interprets the content as HTML. Just passing in a file path will not work. If you want the content, then it has to be wrapped in an appropriate HTML page.

于 2012-02-18T23:31:25.067 回答