I have found the private property _statusItems
.
This is a little category I wrote, I'm not sure if it works, but you can try it out.
Status Bar Category
@implementation NSStatusBar (statusItemCheck)
- (NSArray *)items {
return [self valueForKey:@"_statusItems"];
}
- (BOOL)statusItemIsShown:(NSStatusItem *)statusItem {
if ([self items]) {
NSInteger index = [[self items] indexOfObject:statusItem];
if (index != -1) return YES;
}
return NO;
}
@end
Edit
You should consider adding a BOOL
flag, rather than accessing private methods.
My category is only an example, if you want to upload your app to the MAS, you generally shouldn't use private methods.