我正在使用高清图像,一段时间后,我的内存已经满了,我正在用UIImage *image = [UIImage imageNamed:@""];更新我的图像,这在内存方面是正确的吗?
发布于 2011-05-04 19:54:09
[UIImage imageNamed:]缓存图像。请尝试使用[UIImage imageWithData:]。
发布于 2012-04-26 13:54:06
是的,它起作用了。在我们的应用程序中,我们比较了另一种方法,如
1)
[self.view setBackgroundColor:[UIColor colorWithPatternImage:
[UIImage imageWithContentsOfFile:[
[NSBundle mainBundle] pathForResource:@"mainScreenBackground" ofType:@"png"]]]];占用内存22 mb
2)
[self.view setBackgroundColor:[UIColor colorWithPatternImage:
[UIImage imageWithData:
[NSData ] pathForResource:@"mainScreenBackground" ofType:@"png"]]]];占用内存15mb
非常感谢
https://stackoverflow.com/questions/5882820
复制相似问题