UIImage的两种加载方式

UIImage的两种加载方式

 

1.有缓存:读取后放入缓存中下次可直接读取,适用于图片较少且频繁使用。

[UIImage imageNamed:@"文件名"];

 在缓存中由系统管理,当收到memoryWarning时会释放这些内存资源。

 

2.无缓存:用完就释放掉,参数传的是全路径,适用于图片较多较大的情况下。

NSString *path = [[NSBundlemainBundlepathForResource@"1.png"ofTypenil];

[UIImage alloc] initWithContentsOfFile:path];

 

 

posted @ 2014-04-29 17:45  子柱  阅读(183)  评论(0编辑  收藏  举报