David Gomez
David Gomez

Reputation: 2772

OS X Cocoa Color Combo Box

I'm currently learning to program for OS X / iOS and I'm trying to create a Color Combo Box for my first OS X app (something like you can see in the image below) but I have no idea how to do it and can't find any help or hint in Internet.

enter image description here

Can you please help me to understand which kind of object (visually speaking) I have to choose for my UI and then how to use it with an array of color values to create a session history?

Thank you!

Upvotes: 0

Views: 584

Answers (1)

Jay
Jay

Reputation: 6638

First of all, the control you're looking for is a NSPopUpButton.
(NSPopUpButton Class Reference, Application Menu and Pop-up List Programming Topics)

Depending on what you're actaully trying to achieve using NSAttributedStrings in your menu items with the background color you desire would be an option, e.g.

string = [[NSMutableAttributedString alloc] initWithString:@"MyString"
              attributes:@{NSBackgroundColorAttributeName : [NSColor brownColor]}];

Check e.g. here for details on how to work with attributed strings.

Upvotes: 2

Related Questions