美文网首页
UIImage的渲染模式

UIImage的渲染模式

作者: HAPPY小元宝 | 来源:发表于2017-12-16 17:53 被阅读20次
  • 在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 绘制图片,忽略图片的颜色信息。

相关文章

网友评论

      本文标题:UIImage的渲染模式

      本文链接:https://www.haomeiwen.com/subject/pxtewxtx.html