<分区>
我遇到了 iOS 7 中引入的 UIImage
属性 UIImageRenderingMode
。但是我不明白不同 UIImageRenderingMode
之间的区别是 UIImageRenderingModeAutomatic
、UIImageRenderingModeAlwaysOriginal
和 UIImageRenderingModeAlwaysTemplate
。
我想知道它们的基本含义以及何时/如何使用它们。
<分区>
我遇到了 iOS 7 中引入的 UIImage
属性 UIImageRenderingMode
。但是我不明白不同 UIImageRenderingMode
之间的区别是 UIImageRenderingModeAutomatic
、UIImageRenderingModeAlwaysOriginal
和 UIImageRenderingModeAlwaysTemplate
。
我想知道它们的基本含义以及何时/如何使用它们。
最佳答案
我找到了一个 tutorial这用示例解释了 UIImageRenderingMode
。
来自教程:
UIImageRenderingModeAlwaysTemplate mode will replace all non-transparent colors on a UIImage with the tint color. The entire background and any portion of the image that you do not wish to render using the tint color must be completely transparent.
UIImageRenderingModeAlwaysOriginal. When this is applied the tint color is never applied to the image so the original color is always used when rendering the image.
UIImageRenderingModeAutomatic automatically decides which rendering mode to use based on where the image is being displayed. This is the default value for images.
关于ios - UIImage 渲染模式 : UIImageRenderingModeAutomatic vs UIImageRenderingModeAlwaysOriginal vs UIImageRenderingModeAlwaysTemplate,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21200582/