2011-12-26 88 views
1

我想填充此应用程序,但使用pdf而不是字符串。我能怎么做 ?我想这是在函数 - (无效)createContentPages ...非常感谢帮助。UIPageViewController应用程序 - 使用pdf填充

所使用的示例代码:

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]; 


} 

回答

1

在您引用的示例代码中,基本视图是一个UIWebView,它将内容解释为HTML。只是传入文件路径将不起作用。如果你想要的内容,那么它必须包装在一个适当的HTML页面。