get name of key rather than value of key

Discussion in 'iOS Programming' started by johnmerlino, May 17, 2012.

  1. johnmerlino macrumors member

    Oct 22, 2011
    Hi all,

    I have an nsdictionary like this:

    NSDictionary *code = [data objectForKey:mad:"code"];

    code looks like this:

    code = {
    fence = OFF;

    Now I want to get the name 'fence' rather than the value 'OFF'. So objectForKey wont work. I have a generic method so i can't explicitly ask for "fence".

    thanks for response
  2. Scott90 macrumors 6502

    Jul 14, 2008
    I'm not really sure where you're going with this, but you could try NSDictionary's allKeys: method. This returns an NSArray with all they keys in the NSDictionary. If that's not what you're looking for, please be more descriptive in what you're trying to accomplish.

Share This Page