NSPopupButton Bindings

Discussion in 'Mac Programming' started by knightlie, Jun 4, 2012.

  1. macrumors 6502a

    Joined:
    Feb 18, 2008
    #1
    I always have trouble getting a grasp of NSPopupButton bindings. Here's my scenario:

    I'm setting the currencyCode property of a Core Data object to a three-letter currency code. I use an NSPopupButton to do this with an array of codes bound to Content, but I want the popup menu to show the currency names. Based on the answer here I've tried using an NSDictionary where currencyCode=currencyName, but I get an error along the lines of "Binding contentObjects of object <NSPopUpButton: 0x20043cda0> ignored: Key path (currently bound as arrangedObjects.key) needs to have the content key path (arrangedObjects.value) as prefix".

    I tried using an intermediate CurrencyCode class holding a code and a name, but the three-letter code in the Core Data entity then has nothing to bind to.

    I feel like I'm missing an obvious answer to this, but I always hit a snag when binding popup buttons.
     

Share This Page