I did google too much to find it but not find what i exactly want.
I have file.png, file1.jpg, file2.pdf, file.txt and file.doc and i want to preview this all file in one
UIWebView
or UIScrollView
.
Please help me how can i do it?
Thanks in advance.
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
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`
Once Check this
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];