iPhone:如何设置清晰的窗口大小的“阻止程序视图"? [英] iPhone: how do I set up a clear window-size "blocker view"?

查看:102
本文介绍了iPhone:如何设置清晰的窗口大小的“阻止程序视图"?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我觉得这对我来说应该是显而易见的,但是由于某些原因,我无法弄清楚.我有一个带有导航栏,工具栏和主视图的导航界面.有时,用户执行的操作会导致进度指示器出现在视图的中间.

I feel like this should be obvious to me, but for some reason I can't figure this out. I have a navigation interface with nav bar, tool bar, and primary view. Sometimes the user takes an action that causes a progress indicator to appear in the middle of the view.

虽然进度指示器(这是一个自定义UIView)在中间旋转,但我不希望任何触摸输入都可以进入任何基础界面(主视图,导航栏,工具栏等).但这似乎并不简单.

While the progress indicator (which is a custom UIView) in spinning in the middle, I want no touch input to be allowed to go to any of the underlying interface (main view, nav bar, toolbar, etc). But this doesn't seem trivial.

我尝试过(但失败了)创建一个简单的视图,其唯一的工作就是吞下触摸输入并将其用作窗口子视图-没有骰子,它从不获取触摸事件(是的,它确实具有userInteractionEnabled ).我曾尝试将其作为透明的模态视图控制器使用,但它们似乎从来都不是透明的.

I've tried (and failed) to create a simple view whose only job is to swallow touch input and use it as a window subview-- no dice, it never gets the touch events (and yes, it does have userInteractionEnabled). I've tried to bolt it on as a transparent modal view controller, but those don't seem to ever be transparent.

有什么想法吗?我想念什么?

Thoughts? What am I missing?

谢谢!

推荐答案

您可以停止应用程序接受与的交互事件

You could stop the applicaiton from accepting interaction events with

[[UIApplication sharedApplication] beginIgnoringInteractionEvents];

然后再次开始参加活动

[[UIApplication sharedApplication] endIgnoringInteractionEvents];

但是我会非常小心,因为它会阻止用户一起与您的应用进行交互.

But I would be extremely careful with that as it stops the user from interacting with your app all together.

建议另一条路线.您可以显示仅使用init方法创建的UIAlertView,以将进度指示器容纳在其中.如果您使用init方法,则将没有用户交互的按钮.然后,一旦完成,您就可以关闭警报视图.如果您想为用户提供一种取消操作的方法,您甚至可以使用警报视图上的按钮将其取消.

To suggest another route. You could display a UIAlertView created with just the init method to house the the progress indicator in the middle of it. If you use the init method than there will be no buttons for the user to interact with. Then when ever you are done you can dismiss the alert view. If you wanted to give the user a way to cancel the action you can even use a button on the alert view to cancel it.

这篇关于iPhone:如何设置清晰的窗口大小的“阻止程序视图"?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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