【发布时间】:2013-03-30 11:49:06
【问题描述】:
我正在开发一个 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
【问题讨论】:
-
确保图像名称与您在项目包中添加的图像名称相同 bcz 模拟器不区分大小写..
-
这不是问题。 Iphone 4 完美加载。问题只出在 iPod 上
标签: iphone ios image memory uiwebview