【问题标题】:UIWebview in iOS 6 - To load the content using loadData methodiOS 6 中的 UIWebview - 使用 loadData 方法加载内容
【发布时间】:2014-12-10 20:17:34
【问题描述】:

我尝试使用 loadData 方法在 iOS6-UIWebview 中加载内容(docx、xlxx、.m、.h 等,除了图像和 pdf)。 内容未加载。

如果使用 loadRequest ,内容正在加载。但是, loadData 方法在 iOS 7 及更高版本中运行良好。

我发送的 mime 类型正确。

请澄清一下,是否可以在 iOS 6 中使用 loadData 方法在 UIWebview 中加载内容?

提前致谢。

【问题讨论】:

    标签: ios ios6 uiwebview


    【解决方案1】:

    使用此代码在 webView 中查看文档

    NSURL *url = [[NSURL alloc] initFileURLWithPath:[[NSBundle mainBundle] pathForResource:@"{File Name}" ofType:@"{file Type}"]];
    NSURLRequest *request = [NSURLRequest requestWithURL:url];
    UIWebView *webView = [[UIWebView alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height)];
    [self.view addSubview:webView];
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-07-26
      • 2012-01-13
      • 2015-09-19
      • 2012-12-16
      相关资源
      最近更新 更多