I have NSMUtableArray
, which i need to get the objects name in it .
NSMutableArray *array1 =[NSMUtableArray alloc]init];
[array1 addObject:me];
//me is another array ]
How can i get the name of the object me
, looking in array1
?
I have NSMUtableArray
, which i need to get the objects name in it .
NSMutableArray *array1 =[NSMUtableArray alloc]init];
[array1 addObject:me];
//me is another array ]
How can i get the name of the object me
, looking in array1
?
This is what you are looking for? The dictionary contains key-value pairs.
NSArray *arrayOfKeys = [NSArray arrayWithObjects:@"firstObj",@"secondObj", nil];
YourObjectclass *firstObject = ...;
YourObjectclass *secondObject = ...;
NSArray *arrayOfValues = [NSArray arrayWithObjects:firstArray,secondArray, nil];
NSDictionary *dict = [NSDictionary dictionaryWithObjects:arrayOfValues forKeys:arrayOfKeys];
[dict objectForKey:@"firstObj"]; // return (YourObjectclass*)firstObject
In your case, do the opposite. Swap arrays of keys and values. So, you can get the name of your object, if you will use object as key, and name of the object as value.