Notification when NSPopupButton changes its value in cocoa XCode5

I want to know if this is a method other than

-(void)menu:(NSMenu *)menu willHighlightItem:(NSMenuItem *)item

      

and

-(void)menuDidClose:(NSMenu *)menu

      

to help me know when the value of the NSPopupButton changed (for example by clicking the key name rather than selecting it from NSMenu)

+3


source to share


1 answer


first create your IBAction:

- (IBAction)mySelector:(id)sender {
    NSLog(@"My NSPopupButton selected value is: %@", [(NSPopUpButton *) sender titleOfSelectedItem]);
}

      



and then assign your IBAction to your NSPopupButton

    [popupbutton setAction:@selector(mySelector:)];
    [popupbutton setTarget:self];

      

+9


source







All Articles