Re: NSMenuItem setImage:
Re: NSMenuItem setImage:
- Subject: Re: NSMenuItem setImage:
- From: Matt Neuburg <email@hidden>
- Date: Sat, 15 Jun 2002 17:44:29 -0700
On Fri, 14 Jun 2002 14:10:27 -0700, Matt Neuburg <email@hidden> said:
>
On Wed, 12 Jun 2002 17:39:00 -0700, David Litwin <email@hidden> said:
>
>
> menuItem = [myMenu addItemWithTitle:@"some string"
>
> action:nil
>
> keyEquivalent:@""];
>
>
>
> // Now use this .tiff file as an NSImage for our item
>
> itemImage = [[NSImage alloc] initWithContentsOfFile:@"Some .tiff
>
>file"];
>
> [menuItem setImage:itemImage];
>
>
If you use +imageNamed instead of -initWithContentsOfFile, your code will
>
work. I don't know what the difference is
Just to follow up: I don't think my suggestion got to the heart of the
problem. It turns out that the OP did not reveal what the real problem is:
he's writing a dockling. Images don't work in Dock menus yet, as the
archive shows:
http://cocoa.mamasam.com/COCOADEV/2002/02/2/25864.php
m.
--
matt neuburg, phd = email@hidden,
http://www.tidbits.com/matt
pantes anthropoi tou eidenai oregontai phusei
Subscribe to TidBITS! It's free and smart.
http://www.tidbits.com/
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.