博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
UIImageView 与 UIImage 区别
阅读量:7230 次
发布时间:2019-06-29

本文共 1467 字,大约阅读时间需要 4 分钟。

1.UIImageView不支持内部图片平铺(tile)

2.资源中的图片要用小写的,模拟器中可能不区分大小写,但在真机中区分.
   [UIImage imageNamed:@""]; 在设备中区分大小写
3.UIView没有背景图属性,有背景色属性.设置背景图可以用addSubView(backgroundImage);,推荐的是设置背景色。
4.[UIImage imageNamed:@""];//它是有缓存特性的
  This method looks in the system caches for an image object with the specified name and returns that object if it exists. If a matching image object is not already in the cache, this method loads the image data from the specified file, caches it, and then returns the resulting object.
  On a device running iOS 4 or later, the behavior is identical if the device’s screen has a scale of1.0. If the screen has a scale of2.0, this method first searches for an image file with the same filename with an@2xsuffix appended to it. For example, if the file’s name isbutton, it first searches forbutton@2x. If it finds a 2x, it loads that image and sets thescale property of the returnedUIImage object to2.0. Otherwise, it loads the unmodified filename and sets thescale property to1.0.
   On iOS 4 and later, the name of the file is not required to specify the filename extension. Prior to iOS 4, you must specify the filename extension.
    可能在多次操作之后,应用经常发生内存警告从而导致自动退出的问题。定位之后发现是由于[UIImage imageNamed: @""]分配的图像都没有释放引起的。而之前从官方的reference中得到的信息应该是[UIImage imageNamed:@""]分配的图像系统会放到cache里面。而关于cache管理的规则就没有明确的介绍。由此看来[UIImage imageNamed:]只适合与UI界面中小的贴图的读取,而一些比较大的资源文件应该尽量避免使用这个接口。
  5.  + (UIImage *)imageWithContentsOfFile:(NSString *)path  //这个方法does not cache the image object.

转载地址:http://mipfm.baihongyu.com/

你可能感兴趣的文章
新安装的ubuntu编辑器问题
查看>>
SOJ - 11598
查看>>
[WC2005]双面棋盘(并查集+分治)
查看>>
C#中利用WebBrowser控件,获得HTML源码
查看>>
Android中通过反射获取资源Id
查看>>
Ubuntu Desktop基本办公环境搭建
查看>>
opensuse 13.1 中如何使用yong中文输入法
查看>>
c++堆栈区别
查看>>
HDU 4272 LianLianKan [状态压缩DP]
查看>>
Windows恢复分区管控命令reagentc
查看>>
Ruby操作数据库基本步骤
查看>>
pom.xml介绍
查看>>
浏览器的同源策略和跨域问题
查看>>
Python lambda函数
查看>>
模块与包以及自定义模块
查看>>
ANGULAR $HTTP请求
查看>>
mysql主从复制
查看>>
博客备份专家--豆约翰
查看>>
第七周
查看>>
java 字符串与字符数组相互转换
查看>>