1down voteaccepted

If you're loading images like:
[UIImage imageNamed:@"myImage.png"];
Then the memory for this image will not deallocated, because imageNamed: cache the image. This method is useful for showing some small icons,avatars, etc. So, if you must show many big images, then use
UIImage *myImage = [UIImage imageWithData:[[NSBundle mainBundle] pathForResource:@"myImage" ofType:@"png"];
This will not cache the image and memory will deallocated when retain count will equal to 0 for that object.

Besides that, when you only push a view controller without pop it in future, then the view controller will never deallocated and will always take a place in memory until the app will not crashed/killed, or until the ViewController who holds that view controller will not deallocated.

So, always make sure that you deallocated the viewController if there is no more need of it (i.e. pop it if it was pushed, or dismiss it in case if it was presented modally) and then show your next view controller.

answered Jul 10 at 19:42
arturdev
2,121319
 
1  
Instead of using -dataWithContentsOfFile:, I would suggest using -dataWithContentsOfFile:options:, and use the NSDataReadingMappedIfSafe, so that you don't have the overhead of copying around the file's data to user-space until UIImage reads it. –  Richard J. Ross IIIJul 10 at 20:03

小图用 imageNamed: 大图用 dataWithContentsOfFile:options的更多相关文章

  1. 基于jQuery左侧小图滚动右侧大图显示代码

    今天给大家分享一款 jQuery左侧小图滚动右侧大图显示代码是一款基于jQuery实现的左侧滚动图片点击大图查看效果代码.该实例适用浏览器:IE8.360.FireFox.Chrome.Safari. ...

  2. 京东ie6中轮播模块小图出现在大图上

    请大家给个评论,给个支持!呵呵 本人最新一套模版小清新童装母婴日韩风全屏轮播(上线风暴),在审核时审核失败,报的是“ie6中全屏海报轮播是小图出现在大图中间的兼容性错误” 而本人本机出现的是小图基本上 ...

  3. Python - 工具:将大图切片成小图,将小图组合成大图

    训练keras时遇到了一个问题,就是内存不足,将 .fit 改成 .fit_generator以后还是放不下一张图(我的图片是8192×8192的大图==64M).于是解决方法是将大图切成小图,把小图 ...

  4. jq点击小图 弹出大图(更新版)

    $(function(){ $(".fj1-consult").on("click",function(){ //设置弹框中图片的路径 $(".lay ...

  5. OpenCV 小图重叠至大图指定位置

    Android OpenCV Java: Codes: smallImg.copyTo( bigImg.submat( y, smallImg.rows(), x, smallImg.cols() ) ...

  6. CSS从大图中抠取小图完整教程(background-position应用)

    CSS从大图中抠取小图完整教程(background-position应用)  转自: http://www.cnblogs.com/iyangyuan/archive/2013/06/01/3111 ...

  7. CSS从大图中抠取小图完整教程(background-position应用) (转)

    自认为把background-position的应用讲得非常通俗易懂的教材.做个记号. 相信很多喜欢研究网页界面的童鞋都遇到过一个奇妙的现象:网页中很多图片素材被合成在一张图片上. 起初小菜模仿网站的 ...

  8. 开源方案搭建可离线的精美矢量切片地图服务-8.mapbox 之sprite大图图标文件生成(附源码)

    项目成果展示(所有项目文件都在阿里云的共享云虚拟主机上,访问地图可以会有点慢,请多多包涵). 01:中国地图:http://test.sharegis.cn/mapbox/html/3china.ht ...

  9. Unity4.6 UGUI 图片打包设置(小图打包成图集 SpritePacker)

    版权声明:本文转自http://blog.csdn.net/huutu 转载请带上 http://www.liveslives.com/ 在学习UGUI的过程中,一直使用小图也就是散图,一个按钮一个图 ...

随机推荐

  1. Qt-获取主机网络信息之QNetworkAddressEntry

    QNetworkAddressEntry类存储了一个网络接口所支持的一个IP地址,同时还有与之相关的子网掩码和广播地址. 每个网络接口可以包含0个或多个IP地址,这些IP地址可以分别关联一个子网掩码和 ...

  2. C++带参数默认值的函数

    定义形式: void fun(int a = 1 ,int b = 2 ,int c = 3 ,int d = 4){ //函数定义 cout<<"a="<< ...

  3. Cloudcraft: 云架构图形可视化(智能AWS图表)

    Cloudcraft: 云架构图形可视化(智能AWS图表) 2016.09.11 官方网站: https://cloudcraft.co/ Cloudcraft是一个Web应用,用图形表示各种AWS服 ...

  4. Linux下18b20温度传感器驱动代码及测试实例

    驱动代码: #include <linux/module.h> #include <linux/fs.h> #include <linux/kernel.h> #i ...

  5. Python复杂多重排序

    1. cmp函数是python自带的函数,用于比较两个参数哪个大哪个小 print cmp(2, 3) # -1 如果第一个参数比第二个小,就返回-1,两个元素相等,返回0,否则返回1 2.所以就可以 ...

  6. ASP.NET 学习小记 -- “迷你”MVC实现(1)

    ASP.NET 由于采用了管道式设计,具有很好的扩展性.整个ASP.NET MVC应用框架就是通过扩展ASP.NET实现的.通过ASP.NET的管道设计,我们知道,ASP.NET的扩展点主要是体现在H ...

  7. STL set_difference set_intersection set_union 操作

    以下是STL algorithm的几个函数,使用的条件是有序容器,所以 vector在被sort了之后是可以使用的,set也是可以使用的. set_difference 这个是求得在第一个容器中有,第 ...

  8. UIViewCotroller 的生命周期函数

    Viewcontroller 的所有生命周期函数 重写时 一定要先写 父类 方法 就是(super  +生命周期函数) LoadView ViewDidLoad ViewDidUnload: 在iOS ...

  9. cocos2dx输出信息重定向到控制台

    重定向输出到控制台,方便调试,代码: // uncomment below line, open debug console #define USE_WIN32_CONSOLE int APIENTR ...

  10. ubuntu安装svn manager

    环境:系统ubuntu14.04 0. 更新软件库 sudo apt-get update sudo apt-get upgrade -y 1. 安装apache,svn,svn的apache模块 s ...