I am trying to access a dictionary from an array.
I add the objects to the dictionary like so
[_recentDictionary setObject:videoString forKey:@"video"];
[_recentDictionary setObject:imageString forKey:@"image"];
[_recentDictionary setObject:titleString forKey:@"title"];
[_recentDictionary setObject:descriptionString forKey:@"desc"];
I then add the dictionary to an array like so
for (int i = 0; i<10; ++i)
{
if (i == 0) {
[self.recentArray addObject:_recentDictionary];
}
}
and then save the array via a nsuserdefault
_savedArray = [NSUserDefaults standardUserDefaults];
[_savedArray setObject:self.recentArray forKey:@"recentArray"];
[_savedArray synchronize];
To the call the above in another View
NSUserDefaults *savedDefaults = _showListView.savedArray;
NSMutableArray *savedArray = [[NSMutableArray alloc]initWithObjects:[savedDefaults objectForKey:@"recentArray"], nil];
But I cannot figure out how to access the dictionary in this array.
Retrieve the one by one array element in a dictionary.
NSDictionary *dict = [savedArray objectAtIndex:0];Then access the elements of dictionary(dict) as per your requirement.