我正在开发一个 iPhone/iPad 应用程序。尝试在应用程序本地目录中存储的 UIImage 视图中加载非常大的图像。代码:
NSString *path = [[NSBundle mainBundle] pathForResource:selectedImage ofType:@"jpg"];
NSString *cssString = @"<style type='text/css'>img {width: 100%; height: auto;} body { margin: 0; padding: 0; }</style>";
NSString *htmlString = [NSString stringWithFormat:@"<html><head>%@</head><body><img src=\"file://%@\" /></body></html>",cssString,path];
[webview loadHTMLString:htmlString baseURL:nil];
在 iPhone 和模拟器中,图像可以完美加载,但是当我尝试在 iPod touch 4g 中运行应用程序时,它会错过 UI Webview 中的图像。我想有一些内存问题。没有把握。任何帮助。
图片尺寸为:640*5000