UIViews是否具有alpha = 0或hidden = YES仍然会降低性能? [英] Are UIViews with alpha=0 or hidden=YES still a performance expense?

查看:46
本文介绍了UIViews是否具有alpha = 0或hidden = YES仍然会降低性能?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当视图被隐藏或alpha = 0时,它仍会消耗CPU资源还是被忽略?

When a view is hidden or alpha=0 does it still cost CPU power or is it ignored?

如果我去了:

[view setAlpha:0];

然后

[view setFrame:newFrameRect];

这对性能有何影响?

推荐答案

仍会绘制alpha值为零的内容,但是不会将隐藏的视图重新绘制到屏幕上。由于这种情况仅在视图发生更改时才会发生,因此区别应该是微不足道的...

"Something with an alpha of zero, still is drawn, however a view that is hidden is not redrawn to the screen. Since this only happens when the view changes anyways, the difference should be insignificant..."

因此,setHidden很有用,而更改alpha则不有利。

Therefore, setHidden is useful, while changing the alpha is not as beneficial.

通常,在内存方面,几乎没有好处。您需要将其从视图中移除以最大化性能,但是更改很小,可能没关系。

In general, memory-wise, there is little benefit. You need to remove from view in order to maximize performance, but the change is so small, it probably won't matter.

这篇关于UIViews是否具有alpha = 0或hidden = YES仍然会降低性能?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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