Add/remove application icon from dock at runtime?

半腔热情 提交于 2019-11-30 09:59:45
Francis McGrew

It's a one way street: You can set your app to NSUIElement to hide the dock icon, then call [NSApp setActivationPolicy:NSApplicationActivationPolicyRegular]; to show it in the dock, but once it's there you can't remove it. So you could make the dock icon user-configurable, but you'd have to relaunch the app to hide the icon.


EDIT

You can call setActivationPolicy:NSApplicationActivationPolicyProhibited to hide dock-icon again – user1592530 Sep 18 '12 at 14:21

The comment is right. Works two ways nowadays – Daij-Djan Dec 24 '12 at 11:46


标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!