`

UIImage的2种加载方式的区别

    博客分类:
  • ios
 
阅读更多
方式一:有缓存(图片所占用得内存会一直停留在程序中)
UIImage *image = [UIImage imageNamed:filename];

方式二:无缓存(图片所占用的内存会在一些特定操作后被清除)
NSBundle *bundle = [NSBundle mainBundle];
NSString *path = [bundle pathForResource:filename ofType:nil];
UIImage *image = [UIImage imageWithContentsOfFile:path];
path是图片的全路径

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics