init(named:in:compatibleWith:)
方法生成的image被加入到了系统缓存中去。因此适合于创建频繁使用的图片。这个方法在iOS9以后是线程安全的。imageWithContentsOfFile:
的方法创建的image没有被加入系统缓存中去,每次调用都会重新载入图片。isEqual(_:)
方法,这个方法比较真实的图片数据。cgImage
属性,在Core Graphics框架内。ciImage
属性,在Core Image框架内UIImagePNGRepresentation(_:)
, png格式的数据UIImageJPEGRepresentation(_:_:)
, jpg格式的数据展示一系列图片
UIImage可以展示一些列图片,得到类似gif的图片效果。这些图片应该有相同的size和scale
class func animatedImage(with images: [UIImage], duration: TimeInterval) -> UIImage?
class func animatedResizableImageNamed(_ name: String, capInsets: UIEdgeInsets, duration: TimeInterval) -> UIImage?
class func animatedImageNamed(_ name: String, duration: TimeInterval) -> UIImage?
class func animatedResizableImageNamed(_ name: String, capInsets: UIEdgeInsets, resizingMode: UIImageResizingMode, duration: TimeInterval) -> UIImage?
其中,name
是图片路径的前缀。
原文:http://www.cnblogs.com/huahuahu/p/UIImage-xue-xi-bi-ji.html