Bug in removeStatusItem
Bug in removeStatusItem
- Subject: Bug in removeStatusItem
- From: Trygve Inda <email@hidden>
- Date: Wed, 31 Dec 2014 10:11:10 -0800
- Thread-topic: Bug in removeStatusItem
I am running 10.9.5 with two displays.
I call:
// Prepare status item
[self setStatusItem:[[NSStatusBar systemStatusBar]
statusItemWithLength:24]];
[statusItem setEnabled:YES];
[statusItem setHighlightMode:YES];
[statusItem setMenu:statusMenu];
[statusItem setImage:[NSImage imageNamed:kMenuIconBlackImageName]];
[statusItem setAlternateImage:[NSImage imageNamed:kMenuIconWhiteImageName]];
And later:
// Remove status item
[[NSStatusBar systemStatusBar] removeStatusItem:statusItem];
However it only gets removed from the secondary screen. This thread:
https://devforums.apple.com/message/959387#959387
Says to use:
- (IBAction)removeStatusItem:(id)sender {
[statusBarItem setView:nil];
NSStatusBar *bar = [NSStatusBar systemStatusBar];
[bar removeStatusItem:statusBarItem];
statusBarItem = nil;
}
However, calling:
[[self statusItem] setView:nil];
Crashes my app.
Ideas?
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden