I'm having a student class:
@interface student : NSObject{
NSString *name;
NSDate *date;
}
and i have a NSMutableArray for list of students, and i bound it to a NSPopUpButton like this
content : studentArray, arrangedObjects content values : studentArray, arrangedObjects, name
now I can get the student object like this:
-(IBAction)studentPopupItemSelected:(id)sender
{
NSPopUpButton *btn = (NSPopUpButton*)sender;
int index = [btn indexOfSelectedItem];
student *std = [studentArray objectAtIndex:index];
NSLog(@"%@ => %@", [std name], [std date]);
}
is there any way that i can get the student object directly from NSPopUpButton???? like:
NSPopUpButton *btn = (NSPopUpButton*)sender;
student *std = (student *)[btn objectValueOfSelectedItem];