UIView:不透明与alpha与不透明度 [英] UIView: opaque vs. alpha vs. opacity

查看:520
本文介绍了UIView:不透明与alpha与不透明度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何 opaque alpha 和背景的不透明度一起为UIView工作以及它们之间有什么区别他们?

How do opaque alpha and the opacity of the background work together for a UIView and what are the differences between them?

UIView http://i.minus.com/jb2IP8TXbYTxKr。 png

推荐答案

opaque 表示不绘制<下面是em>任何,即使你是透明的。

opaque means don't draw anything underneath, even if you are transparent.

背景颜色的alpha只影响背景颜色的透明度,而不影响视图上的任何其他颜色。

The background color's alpha only affects the background color's transparency, not anything else drawn on the view.

alpha 影响视图上绘制的所有内容。

alpha affects everything drawn on the view.

opaque属性可以提高您的速度 - 如果您知道您的视图从不具有透明度,您可以将其设置为 YES 当iOS呈现您的视图时,它可以进行一些性能优化并使其更快地呈现。如果设置为 iOS必须将您的视图与下面的视图混合,即使它没有包含任何透明度。

The opaque property can give you a speed increase - if you know that your view will never have transparency you can set this to YES and when iOS renders your view it can make some performance optimisations and render it faster. If this is set to NO iOS will have to blend your view with the view underneath, even if it doesn't happen to contain any transparency.

alpha也会影响背景颜色的alpha,即如果背景颜色为0.5透明且alpha也为0.5,则会产生背景视图的alpha 0.25(0.5 * 0.5) 。

The alpha will also affect the alpha of the backround color i.e. if the background color is 0.5 transparent and the alpha is also 0.5, this has the effect of making the background view's alpha 0.25 (0.5 * 0.5).

这篇关于UIView:不透明与alpha与不透明度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆