"Model key path" of text field and dictionary elem

Discussion in 'Mac Programming' started by i.yalovecky, Apr 29, 2010.

  1. i.yalovecky macrumors member

    Joined:
    Feb 24, 2010
    #1
    I wanna bind dictionary elem to textfield, how i can do this?
     
  2. jared_kipe macrumors 68030

    jared_kipe

    Joined:
    Dec 8, 2003
    Location:
    Seattle
    #2
    UITextField *textField; // assumed its already instantiated.
    NSDictionary *dict; // assume you have a dict already with key @"key"

    textField.text = [dict objectForKey: @"key"];
     
  3. kainjow Moderator emeritus

    kainjow

    Joined:
    Jun 15, 2000
    #3
    You bind to a dictionary just like you'd bind to anything else.

    For example, if you have a Controller object that holds your dictionary "dict" containing a key "Name", then you'd bind to the Controller and set the Model Key Path to "dict.Name".
     

Share This Page