更新时间:2022-11-28 09:27:08
例如通过 HTML sting 显示的图像,此图像在捆绑文件中.webview 中的 HTML 刺痛加载遵循这个!就像您需要使用所有文件创建 html sting 并显示
For Example image showing through HTML sting , This image in bundle file . The HTML sting load in webview follow this ! as like you need creating html sting with all files and display
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 = @"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];