Inherits from | |
Conforms to | |
Framework | /System/Library/Frameworks/AppKit.framework |
Availability | Available in Mac OS X v10.0 and later. |
Companion guide | |
Declared in | NSStatusBar.h |
The NSStatusBar
class defines an object that manages a collection of NSStatusItem
objects displayed within the system-wide menu bar. A status item can be displayed with text or an icon, can provide a menu and a target-action message when clicked, or can be a fully customized view that you create.
Use status items sparingly and only if the alternatives (such as a Dock menu, preference pane, or status window) are not suitable. Because there is limited space in which to display status items, status items are not guaranteed to be available at all times. For this reason, do not rely on them being available and always provide a user preference for hiding your application’s status items to free up space in the menu bar.
Returns the system-wide status bar located in the menu bar.
+ (NSStatusBar *)systemStatusBar
The status bar begins at the right side of the menu bar (to the left of Menu Extras and the menu bar clock) and grows to the left as NSStatusItem
objects are added to it.
NSStatusBar.h
Returns YES
if the receiver has a vertical orientation.
- (BOOL)isVertical
The status bar returned by systemStatusBar
is horizontal, so it always returns NO
.
NSStatusBar.h
Removes the specified status item from the receiver.
- (void)removeStatusItem:(NSStatusItem *)item
The NSStatusItem
object to remove.
Status items to the left of the specified one in the status bar shift to the right to reclaim its space.
NSStatusBar.h
Returns a newly created status item that has been allotted a specified space within the status bar.
- (NSStatusItem *)statusItemWithLength:(CGFloat)length
A float specifying the number pixels of space alloted to the status item.
An NSStatusItem
object or nil
if the item could not be created.
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.
NSStatusBar.h
Returns the thickness of the status bar.
- (CGFloat)thickness
The status bar returned by systemStatusBar
has a thickness of 22 pixels, the thickness of the menu bar.
NSStatusBar.h
The following constants are defined as a convenience by NSStatusBar:
© 2007 Apple Inc. All Rights Reserved. (Last updated: 2007-03-05)