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

引用しているサンプルコードでは、ベースビューはUIWebViewであり、コンテンツをHTMLとして解釈します。ファイルパスを渡すだけでは機能しません。コンテンツが必要な場合は、適切なHTMLページでラップする必要があります。

于 2012-02-18T23:31:25.067 に答える