Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 10th, 2012  |  syntax: None  |  size: 0.60 KB  |  hits: 18  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. How can I change all the values for keys in a plist at once to one particular value?
  2. NSString *newValue;
  3. newValue = @"Y";
  4.  
  5. [manufacturerDictionary setObject:[NSString stringWithString:newValue]
  6.                            forKey:manufacturerName];
  7. [manufacturerDictionary writeToFile: path atomically:YES];
  8. [manufacturerDictionary release];
  9.        
  10. NSString *newValue = @"Y";
  11. NSArray *allKeys = [manufacturerDictionary allKeys];
  12. for (NSString *key in allKeys)
  13. {
  14.     [manufacturerDictionary setObject:newValue forKey:key];
  15. }
  16. [manufacturerDictionary writeToFile:path atomically:YES];
  17. [manufacturerDictionary release];