Adding Items to the Status Bar
16 December 2008
3,512 views
4 Comments
| Buy for Just $4.99 | ![]() |
![]() |
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 | ![]() |
![]() |











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?
looks like the statusItem = nil; line was not mentioned in the video, but is in the source.
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"];
}
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!
Donate to MDN
Shopping Cart
Log In
Join
Lost your Password?
Feeds
The MDN ShowAll of the old episodes of the old shows can be found on The MDN Show Feed
The MDN BIG BLOG
To subscribe to the BIG BLOG point your RSS reader at http://feeds.feedburner.com/mdnbigblog
Categories