忽略AppKit中的UI事件 [英] Ignoring UI Events in AppKit

查看:94
本文介绍了忽略AppKit中的UI事件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果我想在iPhone上忽略UIKit中的触摸事件,我只需:

If I wanted to ignore a touch event in UIKit on the iPhone I would simply do:

// Begin ignoring events
[[UIApplication sharedApplication] beginIgnoringInteractionEvents];
//Do my code 
// Stop ignoring events
[[UIApplication sharedApplication] endIgnoringInteractionEvents];

这允许我的代码在忽略调用之间操作,而不必担心用户交互任何状态的应用程序。

This allows my code in between the "ignore" calls to operate without having to worry about user interaction changing any state of the application.

我的问题是,如果我写一个Mac OS X应用程序(AppKit vs. UIKit),我该怎么办?我基本上想在某些操作(特别是,进行网络调用,并迅速改变状态会排队大量的网络调用,这将迅速阻碍彼此的方式)锁定用户。

My question is, how can I do this if I am writing a Mac OS X app (AppKit vs. UIKit)? I basically want to "lock-out" the user during some operations (specifically, making network calls, and changing state quickly would queue up a ton of network calls that would quickly get in the way of each other).

我需要用AppKit手动管理这个吗?也就是说放置进度条,并手动禁用所有UI元素?

Do I need to manage this manually with AppKit? I.e. put up a progress bar, and disable all UI Elements by hand?

推荐答案

想做这样的事情。它只适用于iPhone,因为没有什么别的用户可能合理地想要做与您的应用程序的时间。在桌面上有多个窗口等的可能性,并且任何时候你的应用程序没有响应被认为是一个错误。

On the desktop you really don't want to do such a thing. It only works on the iPhone because there is nothing else a user might reasonably want to do with your app at the time. On the desktop there are possibilities for multiple windows etc. and anytime your app is unresponsive is considered a bug.

更直接:不,没有这样的。你必须使用表/模态面板实现相同的效果,但大多数时候应该设计UI,这不是一个问题无论如何。

So more directly: No, there is nothing like this. You have to achieve the same effect with a sheet/modal panel, but most of the time should design the UI such that it's not a problem anyhow.

这篇关于忽略AppKit中的UI事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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