-1

I'm trying some stuff, to test the status bar icon feature.

I think I got the all the functions right. However when run. The icon displayed for about 1 mili second then disappeared.

Below is the screenshot of my code:

the code

source code: https://www.dropbox.com/sh/drdxi2zgumc4c3l/s-4J1S418s

Demo video: https://dl.dropbox.com/u/8032222/the%20app%20run%20weird.mov

1
  • 1
    :-) Next time, just post the code rather than a screenshot. Sep 27, 2012 at 14:01

1 Answer 1

1

Retain statusItem object.

statusItem=[[[NSStatusBar systemStatusBar] statusItemWithLength:NSVariableStatusItemLength]retain];  

From Documentation of statusItemWithLength:.

The receiver does not retain a reference to the status item, so you need to retain it. Otherwise, the object is removed from the status bar when it is deallocated.

1
  • Note that retain will be forbidden if you are using ARC.
    – DenVog
    Jan 27, 2013 at 20:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.