Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/iphone/44.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios 如何在UIWebView/UIScrollView中显示多个具有不同文件扩展名的文件?_Ios_Iphone_Uiwebview_Uiscrollview - Fatal编程技术网

Ios 如何在UIWebView/UIScrollView中显示多个具有不同文件扩展名的文件?

Ios 如何在UIWebView/UIScrollView中显示多个具有不同文件扩展名的文件?,ios,iphone,uiwebview,uiscrollview,Ios,Iphone,Uiwebview,Uiscrollview,我在谷歌上搜索了太多,没能找到我想要的东西。 我有file.png、file1.jpg、file2.pdf、file.txt和file.doc,我想在其中预览所有文件 UIWebView或UIScrollView。 请帮我怎么做? 提前感谢。例如,通过HTML sting显示的图像,该图像位于捆绑文件中。webview中的HTML sting加载遵循以下步骤!同样,您需要创建包含所有文件和显示的html sting NSString *imageFileName = @"images";

我在谷歌上搜索了太多,没能找到我想要的东西。 我有file.png、file1.jpg、file2.pdf、file.txt和file.doc,我想在其中预览所有文件
UIWebView
UIScrollView
。 请帮我怎么做?
提前感谢。

例如,通过HTML sting显示的图像,该图像位于捆绑文件中。webview中的HTML sting加载遵循以下步骤!同样,您需要创建包含所有文件和显示的html sting

 NSString *imageFileName = @"images";
    NSString *imageFileExtension = @"jpg";
    NSString *imagePath = [[NSBundle mainBundle] pathForResource:imageFileName ofType:imageFileExtension];
    NSString *imgHTMLTag = [NSString stringWithFormat:@"<img src=\"file://%@\" />", imagePath];
    [myWebView loadHTMLString:imgHTMLTag baseURL:nil];`enter code here`
NSString*imageFileName=@“图像”;
NSString*imageFileExtension=@“jpg”;
NSString*imagePath=[[NSBundle mainBundle]pathForResource:imageFileName类型:imageFileExtension];
NSString*imgHTMLTag=[NSString stringWithFormat:@',imagePath];
[myWebView loadHTMLString:imgHTMLTag baseURL:nil]`在这里输入代码`
检查一下这个

 NSString *imageFileName = @"images";
    NSString *imageFileExtension = @"jpg";
    NSString *imagePath = [[NSBundle mainBundle] pathForResource:imageFileName ofType:imageFileExtension];
    NSString *pdfPath = [[NSBundle mainBundle] pathForResource:@"Disciplinary" ofType:@"pdf"];
    NSString *imgHTMLTag = [NSString stringWithFormat:@"<html><body><img src=\"file://%@\" /></body><body><img src=\"file://%@\" /></body><body><img src=\"file://%@\" /></body></html><body><object id =\"PDFObj\" data=\"file://%@\"/ type=\"application/pdf\" width = \"1000\" height = \"10000\"></body>", imagePath,imagePath,pdfPath,pdfPath];
    [img loadHTMLString:imgHTMLTag baseURL:nil];
NSString*imageFileName=@“图像”;
NSString*imageFileExtension=@“jpg”;
NSString*imagePath=[[NSBundle mainBundle]pathForResource:imageFileName类型:imageFileExtension];
NSString*pdfPath=[[NSBundle mainBundle]pathForResource:@“纪律性”类型:@“pdf”];
NSString*imgHTMLTag=[NSString stringWithFormat:@',imagePath,imagePath,pdfPath,pdfPath];
[img loadHTMLString:imgHTMLTag baseURL:nil];

试试QLPriview控制器在HTML(字符串)页面上以其他方式创建,包括在UIWebVIEW中加载的所有文件您有任何示例代码吗?仅供参考:我还需要总页数。例如,通过HTML sting显示的图像,该图像在捆绑文件中。webview NSString*imageFileName=@“图像”中的HTML sting加载;NSString*imageFileExtension=@“jpg”;NSString*imagePath=[[NSBundle mainBundle]pathForResource:imageFileName类型:imageFileExtension];NSString*imgHTMLTag=[NSString stringWithFormat:@',imagePath];[myWebView loadHTMLString:imgHTMLTag baseURL:nil];这是一个例子,一旦尝试获得更多信息任何网页设计师,我更新我的两张图片一个pdf显示(这是不确切的方式)我想你不清楚我的要求,我想加载file.png,file1.jpg,file2.pdf,file.txt和file.doc在单视图(Webview/scrollview)是这一步只!您正在使用上述示例中的所有文件创建HTML字符串并加载到webviewOk检查是否有任何问题我将帮助您打开一个文档:(总页数指