制作复选框可开启和关闭Dock图标 [英] Making a Checkbox Toggle The Dock Icon On and Off

查看:190
本文介绍了制作复选框可开启和关闭Dock图标的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果勾选了底座图标,我如何使复选框隐藏?
我做了一个复选框切换菜单项,但你会怎么做与dock图标?
寻找一些代码来做到这一点。
谢谢!

How would I make a checkbox hide the dock icon if it was checked? I have made a checkbox toggle a menubar item but how would you do it with the dock icon? Looking for some code to do this. Thanks!

推荐答案

我已使用此代码:

BOOL iconInDock = [[NSUserDefaults standardUserDefaults] boolForKey:smHideShowIcon];
if (iconInDock) {
    ProcessSerialNumber psn = { 0, kCurrentProcess };
    // display dock icon
    TransformProcessType(&psn, kProcessTransformToForegroundApplication);
}

确定,如果我在LSUIElement = Info.plist。这是代码只适用于显示,但我如何可以隐藏图标?

ok, it's work for my application if I to set LSUIElement=1 in the Info.plist. That's code works only for show, but how I can hide icon?

这篇关于制作复选框可开启和关闭Dock图标的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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