-2

i'd like to know how i can print the contents of a NSDictonary of unknown size fully in a NSTextField? The output should look like this at the end:

Key1: Value
Key2: Value
Key3: Value
.
.
.
KeyN: Value

p0fi
  • 1,056
  • 12
  • 28

1 Answers1

1
NSMutableString *mutableString = [NSMutableString new];
for (id key in myDictionary)
{
    [string appendFormat:@"%@: %@\n", key, myDictionary[key]];
}
// Delete last newline
[string deleteCharactersInRange:NSMakeRange([string length]-1, 1)];
myTextField.text = mutableString;
Ricardo Sanchez-Saez
  • 9,466
  • 8
  • 53
  • 92