阻止用户与基础视图的交互 [英] blocking user interaction with underlying views

查看:127
本文介绍了阻止用户与基础视图的交互的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的应用程序中,我有一个重叠视图,当一些处理和网络发生时显示。它只是一个半透明视图(UIView的子类),上面有一个加载指示器,填满整个屏幕。

In my app, i have an overlay view, which is displayed when some processing and networking is happening. It is just a semitransparent view (subclass of UIView) with a loading indicator on it, filling the whole screen.

我想阻止任何底层视图接收用户 - 交互(例如,不应该滚动基础表视图,不按下按钮)。

I want to prevent any of the underlying views to recieve user-interaction (e.g. a underlying table view should not be scrolled, a button not be pressed).

我可以在叠加视图中做最好的方式是什么?

What is the best way i can do this from within the overlay view?

推荐答案

只需将覆盖视图的 userInteractionEnabled 属性设置为 YES 。这将导致所有触摸事件发生在重叠式视图上,而不会传递到基础视图。

Just set the userInteractionEnabled property for the overlay view to YES. This will cause all touch events to occur on the overlay view and not be passed to the underlying views.

这篇关于阻止用户与基础视图的交互的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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