Re: NSMenuItem setImage:
Re: NSMenuItem setImage:
- Subject: Re: NSMenuItem setImage:
- From: Matt Neuburg <email@hidden>
- Date: Fri, 14 Jun 2002 14:10:27 -0700
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];
>
>
I've checked that itemImage isn't nil, and in fact has the right
>
dimensions of the .tiff loaded, so it seems to have been loaded
>
correctly but just doesn't want to display
If you use +imageNamed instead of -initWithContentsOfFile, your code will
work. I don't know what the difference is; I just follow the example Apple
gives us (MenuMadness). 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.