NSAlert没有弹跳码头图标 [英] NSAlert without bouncing dock icon

查看:99
本文介绍了NSAlert没有弹跳码头图标的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果您在应用程式位于背景中的情况下放置 NSAlert ,您的Dock图示会开始弹跳,并持续弹跳,直到您切换回来。

If you put up an NSAlert while your app is in the background your dock icon starts bouncing and keeps on bouncing until you switch back.

我觉得这很烦人。

有人知道单一应用程式的停用功能吗?

Does anyone know how disable that for a single app?

推荐答案

创建自己的NSApplication子类,并实现这样的

Create your own subclass of NSApplication, and implement something like this:

- (int)requestUserAttention:(NSRequestUserAttentionType)requestType
    {
        if (dontDoThatBouncyThing) {
            return 0;
        }
        return [super requestUserAttention:requestType];
    }

不要忘记将Info.plist中的NSPrincipalClass从NSApplication到你自己的NSApplication子类。

Don't forget to change "NSPrincipalClass" in your Info.plist from NSApplication to your own NSApplication subclass.

这篇关于NSAlert没有弹跳码头图标的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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