Home » Intermediate

Adding Items to the Status Bar

16 December 2008 3,512 views 4 Comments
Buy for Just $4.99 Add to Cart View Cart

Many application take advantage of the Mac OS X status bar to report their status or allow fast access to key program features.

This short video course will show you how to add your own text and images to the status bar and respond to actions performed upon it.

Who Is This Course For?
Anybody looking to add a StatusBar item to their application and doesn’t know how.

What do you get?

  • 25 Minute HD (1280 x 720) training video on adding and removing items from the status bar. 
  • The video is formatted as DRM free .mp4 file. (85MB)
  • You also receive a file formatted at 480×272 for use on your iPhone or iPod Touch (29MB)
  • All the sample code displayed on the training videos.

Course Content

  • What is the Status Bar?
  • What is a Status Bar Item?
  • Adding an to the Status Bar
  • Adding text to the Status Bar
  • Adding an image to the Status Bar
  • Adding an alternate image to the Status Bar
  • Handling actions from the Status Bar
  • Adding a menu to the Status Bar
  • Removing an item from the Status Bar
Buy for Just $4.99 Add to Cart View Cart

4 Comments »

  • craibuc said:

    Thanks, I enjoyed the tutorial.

    I think there is an error w/ the code. If you add a statusItem, remove it, then try to add it again, the [self removeStatusItem] message is executed. Are you certain that (statusItem == nil) is right test?

  • craibuc said:

    looks like the statusItem = nil; line was not mentioned in the video, but is in the source.

  • Kevin Yank said:

    As craibuc has pointed out, there is a glaring bug in this example. In the removeStatusItem method, statusItem is released, but it is not set to nil. As a result, the next call to buttonClicked results in removeStatusItem being triggered again, and the program crashing.

    Here is the corrected code for removeStatusItem:

    - (void) removeStatusItem
    {
    [[NSStatusBar systemStatusBar] removeStatusItem:statusItem];
    [statusItem release];
    statusItem = nil; // THIS LINE ADDED TO PREVENT CRASH
    [button setTitle:@"Add Status Item"];
    }

  • Scotty (author) said:

    The code in the video does miss the statusItem=nil out.
    I have added a note to the video to point this out.
    The sample code that comes with the course in however is (and always has been) correct and does contain the missing line.

Leave your response!

Add your comment below, or trackback from your own site. You can also subscribe to these comments via RSS.

Be nice. Keep it clean. Stay on topic. No spam.

You can use these tags:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="">

This is a Gravatar-enabled weblog. To get your own globally-recognized-avatar, please register at Gravatar.