首页 > 其他 > 详细

initWithImage和imageWithContentsOfFile的区别

时间:2014-08-18 12:11:54      阅读:324      评论:0      收藏:0      [点我收藏+]
UIImageView *imageView = [[UIImageView alloc] initWithImage:
        [UIImage imageNamed:@"icon.png"]]; // 会缓存图片
 
UIImageView *imageView = [[UIImageView alloc] initWithImage:
        [UIImage imageWithContentsOfFile:@"icon.png"]]; // 不会缓存图片
 
application bundle的顶层文件夹寻找由供应的名字的图象。如果找到图片,装载到iPhone系统缓存图象。那意味图片是(理论上)放在内存里作为cache的。这样图片会占用大量的内存,imageWithContentsOfFile不会缓存图片,所有比较节省内存。

initWithImage和imageWithContentsOfFile的区别,布布扣,bubuko.com

initWithImage和imageWithContentsOfFile的区别

原文:http://www.cnblogs.com/geek6/p/3919007.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!