【发布时间】:2012-02-15 14:14:58
【问题描述】:
我遇到了关于 webView 和 Pdf 的问题 ..
当我加载一个大小为 10 mb 的 pdf 文件时 ..
文件需要很长时间才能加载,而且我的 Pdf 也不能很好地滚动...
谁能告诉我可能是什么问题?
这里是代码...
if ([resource.resource_type isEqualToString:@"pdf"] ) {
tempStr = [NSString stringWithFormat:@"%@.pdf",resource.resource_link];
type = [NSString stringWithFormat:@"pdf"];
}
else {
tempStr = [NSString stringWithFormat:@"%@.jpg",resource.resource_link];
type = [NSString stringWithFormat:@"jpg"];
}
NSArray *myArray = [tempStr componentsSeparatedByString:@"."];
NSString *path = [[NSBundle mainBundle] pathForResource:[myArray objectAtIndex:0] ofType:[myArray objectAtIndex:1]];
NSLog(@"array elemt :%@", [myArray objectAtIndex:0]);
NSLog(@"array elemt 1 :%@", [myArray objectAtIndex:1]);
NSLog(@"path is :%@",path);
if (isFirstTime) {
NSURL *targetURL = [NSURL fileURLWithPath:path];
NSURLRequest *request = [NSURLRequest requestWithURL:targetURL];
[docWebView loadRequest:request];
isFirstTime = NO;
}
if(isLandscape == NO){
docWebView.frame = CGRectMake(0.0, 44.0, 768.0, 960.0);
}
else {
docWebView.frame = CGRectMake(0.0, 44.0, 1024.0, 700.0);
}
[self.view addSubview:docWebView];
[self.view bringSubviewToFront:activity];
【问题讨论】: