-1

I have the following type of a NSMutableDictionary

(
        {
        id = 1;
        key = value;
        key = value;
    },
        {
        id = 2;
        key = value;
        key = value;
    }
)

It contains multiple data of an own Object. Now, in cellForRowAtIndexPath. I created a CustomCell that has a field CustomCell.customObject that should get this object. What I'm trying to do is the following. I want to assign the current entry of the NSMutableDictionary to this field.

Alternatively I could do this (and am doing it right now) I'm getting the ID like this

NSString *objectId = [[dict valueForKey:@"id"] objectAtIndex:indexPath.row];

And then I'm loading the object from the database. The problem I'm seeing in this, is the doubled request. I mean, I already have the data in my NSMutableDictionary, so why should I request it again?

I don't want to just assign a certain key-value pair, I want to assign the whole current object entry of the NSMutableDictionary. How would I do this?

Musterknabe
  • 5,763
  • 14
  • 61
  • 117

1 Answers1

0

If the above code (dictionary) is used to show information on tableview there is a mistake in it dictionary should always starts with "Key" not with index. So better make the dictionary to array and then you will have index to get complete information in indexes write this code

NSLog(@"%@",[[newArray objectAtIndex:0]objectForKey:@"id"]);

Hope this will help..

Charan Giri
  • 1,097
  • 1
  • 9
  • 15