 |
 |
NSStatusItem icon not showing
|
 |
|
 |
|
Fresh-Faced Recruit
Join Date: May 2002
Location: Ft Lauderdale
Status:
Offline
|
|
Hi, I have an NSStatusItem app. The item works, I can use setTitle and that shows up, but my icon wont show up.
</font><blockquote><font size="1" face="Geneva, Verdana, Arial, sans-serif">code:</font><hr /><pre style="font-size:x-small; font-family: monospace;">NSStatusBar *statusBar = [NSStatusBar systemStatusBar];
NSStatusItem *statusItem = [[statusBar statusItemWithLength:NSSquareStatusItemLength] retain];
NSImage *myIcon = [[NSImage alloc] initWithContentsOfFile:@"myIcon.tiff& quot;];
[statusItem setImage:myIcon];</pre><hr /></blockquote><font size="1" face="Geneva, Verdana, Arial, sans-serif">I added the image to the resources and all that. I also tried initByReferencingFile to init the image, no difference. Can anyone think of anything?
TIA,
Mark
|
|
|
| |
|
|
|
 |
|
 |
|
Grizzled Veteran
Join Date: Feb 2001
Location: Germany
Status:
Offline
|
|
have you tried [NSImage imageNamed:@"myIcon.tiff"]?
|
|
|
| |
|
|
|
 |
|
 |
|
Fresh-Faced Recruit
Join Date: May 2002
Location: Ft Lauderdale
Status:
Offline
|
|
I just tried that, same thing. All I'm getting is the blank space where it should be. I'll keep working on it, any other ideas?
|
|
|
| |
|
|
|
 |
|
 |
|
Addicted to MacNN
Join Date: Mar 2000
Location: London, UK
Status:
Offline
|
|
Try:
NSImage *myIcon = [[NSImage alloc] initWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"myIcon" ofType:@"tiff"]];
|
|
|
| |
|
|
|
 |
|
 |
|
Grizzled Veteran
Join Date: Feb 2001
Location: Germany
Status:
Offline
|
|
just an idea... where do you declare the nsstatusitem? in the method that sets it up? have you tried moving the declaration to your header file?
|
|
|
| |
|
|
|
 |
|
 |
|
Addicted to MacNN
Join Date: Mar 2000
Location: London, UK
Status:
Offline
|
|
</font><blockquote><font size="1" face="Geneva, Verdana, Arial, sans-serif">quote:</font><hr /><font size="1" face="Geneva, Verdana, Arial, sans-serif">Originally posted by seb2:
<strong>just an idea... where do you declare the nsstatusitem? in the method that sets it up? have you tried moving the declaration to your header file?</strong></font><hr /></blockquote><font size="1" face="Geneva, Verdana, Arial, sans-serif">That wouldn't make any difference. The statusitem will still exist even if you don't have a pointer to it.
|
|
|
| |
|
|
|
 |
|
 |
|
Fresh-Faced Recruit
Join Date: May 2002
Location: Ft Lauderdale
Status:
Offline
|
|
The problem was I put the image file in PB resources(like you would for an app icon), but it needed to be in IB's images panel( <img border="0" alt="[Hmmm]" title="" src="graemlins/hmmm.gif" /> ). Thanks for the help.
|
|
|
| |
|
|
|
 |
|
 |
|
Grizzled Veteran
Join Date: Feb 2001
Location: Germany
Status:
Offline
|
|
agnus, you're right, of course. stupid me.
vasudevelopa, you mean you're storing the images *inside* the nib? that's possible, but that method of storing images is deprecated.
|
|
|
| |
|
|
|
 |
|
 |
|
Fresh-Faced Recruit
Join Date: May 2002
Location: Ft Lauderdale
Status:
Offline
|
|
Really? I don't understand why the image wouldn't draw until it was added to the NIB. All of the code posted should potentially work...
|
|
|
| |
|
|
|
 |
 |
|
 |
|
|
|
|
|

|
|
 |
Forum Rules
|
 |
 |
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
|
HTML code is Off
|
|
|
|
|
|
 |
 |
 |
 |
|
 |
|