UIImage的渲染模式

  • 在iOS7有了 imageWithRenderingMode ,这是UIImage的一个方法,是一个有三个参数的枚举值。
  public enum UIImageRenderingMode : Int {
    case automatic // Use the default rendering mode for the context where the image is used
    case alwaysOriginal // Always draw the original image, without treating it as a template
    case alwaysTemplate // Always draw the image as a template image, ignoring its color information
}
  • automatic:由系统决定根据图片使用环境来决定如何渲染图片。如你的图片使用在tarbar上,图片使用alwaysTemplate渲染模式,用在其他地方则为alwaysOriginal。

  • alwaysOriginal:根据图片原来的样子渲染图片

  • alwaysTemplate:根据当前的 Tint Color 绘制图片,忽略图片的颜色信息。

©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容