Making a Checkbox Toggle The Dock Icon On and Off

前端 未结 5 888
不思量自难忘°
不思量自难忘° 2021-01-31 06:17

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

5条回答
  •  不知归路
    2021-01-31 06:52

    Setup your application as an LSUIElement and then call:

    [NSApp setActivationPolicy:NSApplicationActivationPolicyRegular];
    

    on launch.

    This works for the MAS too.

提交回复
热议问题