tags:

views:

37

answers:

2

Hi,

How can i display a list of images stored in an array as list item in pop up button.

If not possible, what can be the alternative way to do so.

+1  A: 

If you want to let the user chose an image from a selection, you should consider ImageKit and its IKImageBrowserView

Nikolai Ruhe
Unfortunately, that is not my requirement.
iSight
+1  A: 

NSMenuItem has a -setImage: method which allows you to assign a image to be displayed with the menu item in a popup button.

NSMenu has a number of methods which allow you to obtain the NSMenuItem's from it, like -itemWithTag:, itemWithTitle:, etc.

Furthermore, NSPopupButton has a number of methods which allow you to obtain the NSMenuItem's from it like, -itemArray, -itemAtIndex:, etc. and, of course, a -menu method which allows you to obtain its NSMenu directly.

ericgorr
is it that i have to add image objects in menu and add that menu to popupbutton to display.
iSight
No, you should simply need to grab the NSMenuItem's from the button and use the -setImage: method.
ericgorr