Search code examples
cocoanspopovernsapplication

How to create an arrow pointing to my app's icon on the menu bar?


I have a menu bar only application. On the first time the user runs the app I want to create an animated arrow pointing to my app's icon on the menu bar.

The first idea I had was to create a NSPopover showing the arrow but that is obtrusive per se because I don't think I can make the popover invisible at all. I just want to make an arrow moving up and down pointing to my app's icon on the menubar and that must be App Store compatible.

Is that possible? How?


Solution

  • You can create a borderless transparent window and set its level to screen saver and set it to ignore mouse clicks. Within this window you can draw your arrow, again use a transparent content view. Look up the docs on NSWindow, NSView etc. to construct this.

    Alternatively you can change the menu bar icon of your app itself - switch it, highlight it, animate it. This is the typical way a menu bar app attracts attention. Look up NSStatusItem and NSStatusBarButton.

    HTH