Sag*_*gar 5 uiwebview ios swift
我们可以使用UIWebview在iphone中打开并查看.doc,.docx,.rtf,.ppt,.pptx,.xls,.xlsx文件吗?
我正在使用Document目录来显示该文件.
.doc文件在这里工作正常...但其余文件的扩展名无法正常工作..
如果有人实施了这个,请帮帮我...
任何代码段或任何网络链接帮助...
提前致谢...
Fel*_*oux 14
您可能需要查看适用于iOS的QuickLook Framework:https: //developer.apple.com/library/ios/documentation/FileManagement/Conceptual/DocumentInteraction_TopicsForIOS/Articles/UsingtheQuickLookFramework.html
它支持以下格式:
更具体地说,您可能需要查看QLPreviewController:https://developer.apple.com/library/ios/documentation/NetworkingInternet/Reference/QLPreviewController_Class/Reference/Reference.html#//apple_ref/occ/cl/QLPreviewController
小智 -3
尝试这个:
[self.m_webView loadRequest:[NSMutableURLRequest requestWithURL:[NSURL fileURLWithPath:_m_filePath]cachePolicy:NSURLCacheStorageAllowedInMemoryOnly timeoutInterval:3.0]];
Run Code Online (Sandbox Code Playgroud)
您可以更改timeoutInterval和cachePolicy,有时您必须等待更多时间才能加载。