NSMutableDictionary removeObjectForKey
- (void)removeObjectForKey:(id)aKey
Parameters
aKey
The key to remove.
Discussion of [NSMutableDictionary removeObjectForKey]
Does nothing if aKey does not exist.
For example, assume you have an archived dictionary that records the call letters and associated frequencies of radio stations. To remove an entry for a defunct station, you could write code similar to the following:
NSMutableDictionary removeObjectForKey example.
NSMutableDictionary *stations = nil;
stations = [[NSMutableDictionary alloc]
initWithContentsOfFile: pathToArchive];
[stations removeObjectForKey:@"KIKT"];
stations = [[NSMutableDictionary alloc]
initWithContentsOfFile: pathToArchive];
[stations removeObjectForKey:@"KIKT"];
Example of [NSMutableDictionary removeObjectForKey].
First you need to use a NSMutableDictionnary and put this code :
[countriesToLiveInDict removeObjectForKey:@"Countries"];
[countriesToLiveInDict setObject:sortedArray forKey:@"Countries"];
[countriesToLiveInDict removeObjectForKey:@"Countries"];
[countriesToLiveInDict setObject:sortedArray forKey:@"Countries"];
NSMutableDictionary removeObjectForKey example.
[dictionary removeObjectForKey:viewerKeys[indexPath.row]]; // remove array from dictionary
[viewerKeys removeObjectAtIndex:indexPath.row]; // remove key from array of dictionary keys
[viewerKeys removeObjectAtIndex:indexPath.row]; // remove key from array of dictionary keys