本文介绍了UIView的opaque属性值是YES,与backgroundColor属性冲突,值为[UIColor clearColor]吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

例如代码:

view.opaque = YES;

view.backgroundColor = [UIColor clearColor];

任何人可以解释一下这个问题吗?

any one who can explain something about this?

编辑

如文件所示:

opaque 属性用于确定视图是否可以优化合成操作。

opaque property is used for determining whether the view can optimize compositing operations.

所以问题是:

如果我设置 view.opaque = YES view.backgroundColor = [UIColor clearColor] ,前者性能提升,后者怎么样?

if i set view.opaque = YES and view.backgroundColor = [UIColor clearColor],the former increased performance,how about the latter?

推荐答案

不,它不应该。它应该行动清楚。颜色清晰是完全不透明的,如果这甚至是有意义的。如果您更改其alpha,它将不会显示黑色或白色或其他任何内容。很明显。

No, it shouldn't be. It should act clear. The color clear is completely opaque, if that even makes sense. It won't show up black or white or anything else if you change its alpha. It will be clear.

这篇关于UIView的opaque属性值是YES,与backgroundColor属性冲突,值为[UIColor clearColor]吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-02 09:14