• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
NSMenuItem setImage:
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

NSMenuItem setImage:


  • Subject: NSMenuItem setImage:
  • From: David Litwin <email@hidden>
  • Date: Wed, 12 Jun 2002 17:39:00 -0700

I'd like to have a small icon show to the left of my menu item, and NSMenuItem setImage: seems to be just the thing. But it doesn't seem to be working for me. The menu items show up fine, no errors are reported, but no icons show. Here's a snippet of the code:

NSMenu* myMenu;
NSMenuItem* menuItem;
NSImage* itemImage;

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.

Has anyone used setImage with NSMenuItem?

Thanks,

David Litwin
Senior Software Engineer
Connectix
_______________________________________________
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.

References: 
 >NSMenu and NSMenuView (From: David Litwin <email@hidden>)

  • Prev by Date: catching and handling errors
  • Next by Date: Re: OOP and Foundation 3: Protocols and collections
  • Previous by thread: NSMenu and NSMenuView
  • Next by thread: -[NSResponder flagsChanged:] not called?
  • Index(es):
    • Date
    • Thread