How do I fill NSPopupButton with an array of strings?

Simple question, but I'm trying a little to understand how Interface Builder interacts with the rest of the X-Code program.

My UI has an NSPopupButton that I would like to populate with an array of strings that I provide. I have a controller class that defines how to execute when a button is clicked. Is this where I am going to populate the NSPopupButton? It seems like I need to initialize somewhere, but I'm confused exactly where to do this. I know I need to use addItemsWithTitles, but where do I call it?

+1


source to share


1 answer


Assuming the list doesn't change over time, awakeFromNib (in the controller) would be a good place to populate the menu. If it is dynamic, then you want to fill it up when the source of those rows changes.



+2


source







All Articles