view的hidden = yes和alpha = 0.0f之间有什么区别 [英] what's the difference between view's hidden = yes and alpha = 0.0f
本文介绍了view的hidden = yes和alpha = 0.0f之间有什么区别的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个关于 UIView
的问题,隐藏的视图,alpha和opaque之间有什么区别?
I have a question about UIView
, what's the difference between views hidden, alpha and opaque?
设置视图的效果:hidden = yes和view.alpha = 0.0f是相同的。
The effect of setting view: hidden = yes and view.alpha = 0.0f is the same.
推荐答案
差异很微妙。
根据 UIView类参考:
-
opaque
告诉系统视图没有透明度并且因此可以更快地渲染,因为可以跳过混合计算 -
隐藏
是布尔属性,仅更改当前视图的可见性并将其隐藏在ui事件中。 -
alpha
是一个可动画的属性
opaque
tells the system that the view has no transparency and is thus faster to render because calculations for blending can be skippedhidden
is boolean property that changes only the visibility of the current view and hides it from ui events.alpha
is an animatable property
设置 alpha = 0.0f
或 hidden = YES
具有相同的视觉效果。
但是使用隐藏
来实际隐藏视图不仅在图形意义上而且从ui事件中隐藏视图可能会在你有大量嵌套时产生更有效的响应链观点。
Setting alpha = 0.0f
or hidden = YES
has the same visual effect.
However using hidden
to actually hide a view not only in a graphical sense but also from ui events might result in a more efficient responder chain when you have lots of nested views.
这篇关于view的hidden = yes和alpha = 0.0f之间有什么区别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文