UIView隐藏的财产...有更多的吗? [英] UIView hidden property...is there more to it?

查看:153
本文介绍了UIView隐藏的财产...有更多的吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

来自ActionScript,我会将Sprites设置为visible = false,以防止它们像布局一样计算,并确保它们不会响应事件。

Coming from ActionScript, I would set Sprites to visible=false in order to keep them from being calculated in things like layout, and to ensure they would not respond to events.

在iOS开发中,我继续这样做 - 如果不需要UIView,我可以将其alpha设为零,然后设置hidden = true。我想知道我是否在浪费我的时间,或者是否有益于此。在我目前的项目中,我正在使用UIImageViews,这些都是无反应的。

In iOS development, I am continuing with this--if a UIView is not needed, I may both animate its alpha to zero and then set hidden=true. I wanted to know if I was wasting my time, or if there is a benefit to this. In my current project, I'm doing so with UIImageViews which are not responding to events anyway.

设置隐藏为真正的良好做法,还是额外的开销?

Is setting hidden to true good practice, or or just additional overhead?

推荐答案

这是最好的选择,因为隐藏为true的设置将从render循环中删除视图。将alpha设置为0时,只会使视图透明。

This is the best choice, because setting hidden to true removes view from the render loop. While setting alpha to 0 just makes view transparent.

这篇关于UIView隐藏的财产...有更多的吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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