UIImage的渲染模式
2017-12-16 本文已影响20人
HAPPY小元宝
- 在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
绘制图片,忽略图片的颜色信息。