【问题标题】:scrolling issue while adding heavy file in UIWebView in iphone在 iphone 的 UIWebView 中添加重文件时出现滚动问题
【发布时间】: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];

【问题讨论】:

    标签: iphone xcode pdf webview


    【解决方案1】:

    10 Mb 是一个大文件,特别是如果它包含图像...尝试用 iBooks 打开它,看看需要多少时间.. 问题可能与您的代码无关,我认为它在文件大小上。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2018-04-04
      • 2011-09-12
      • 2011-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2010-09-08
      • 1970-01-01
      相关资源
      最近更新 更多