确定UIView是否对用户可见? [英] Determine if UIView is visible to the user?

查看:276
本文介绍了确定UIView是否对用户可见?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以确定我的 UIView 是否对用户可见?

is it possible to determine whether my UIView is visible to the user or not?

我的视图是添加为子视图多次进入标签栏控制器

My View is added as subview several times into a Tab Bar Controller.

此视图的每个实例都有一个 NSTimer 更新视图。

Each instance of this view has a NSTimer that updates the view.

但是我不想更新一个用户看不到的视图。

However I don't want to update a view which is not visible to the user.

这可能吗?

谢谢

推荐答案

您可以查看是否:


  • 它是隐藏,通过检查view.hidden

  • 它位于视图层次结构中,通过检查 view.superview!= nil

  • 你可以检查一个视图的边界,看看它是否在屏幕上

唯一的另一件事我可以想到的是,如果你的观点被埋没在其他人的背后,并且因为这个原因而无法看到。您可能需要查看之后的所有观看内容,看看它们是否模糊了您的观点。

The only other thing I can think of is if your view is buried behind others and can't be seen for that reason. You may have to go through all the views that come after to see if they obscure your view.

这篇关于确定UIView是否对用户可见?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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