Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Fritzables

macrumors regular
Original poster
May 6, 2011
149
1
Brisbane AUSTRALIA
Hi to All,

As some of you are aware, I am in my very early stages of developping for Mac after leaving Windows to take up with Mac. I still have a lot to learn and enjoying the new skills.

My question is. If I have created an object of NSPopUpButton and called it myPopUp (in this example).

In it's simplessed form, would I return the string of the selected item like this:

Code:
NSString *returnedValue = [myPopUp titleOfSelectedItem];

Or have I missed the mark by a long shot ??

Pete
 
Well, probably the more standard way to do it is to create a Pop Up button by dragging it to your window in Interface Builder. Then create an outlet to the button in whatever controller you want.

Then yes, you should be able to call:

Code:
NSString *sel = [mybutton titleOfSelectedItem];

or maybe

Code:
NSInteger sel = [mybutton indexOfSelectedItem];

... which ever is more convenient. Assuming mybutton is declared as an outlet to the button.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.