I have the following method:
- (NSString *)description {
return [NSString stringWithFormat:@"Attribute %@: %@", name, [values description]];
}
Name is a string, values is an NSArray. I have an NSArray containing several of these objects.
When I print the attribute using NSLog(@"Attribute created: %@", [newAttribute description]);
it works fine, and prints this:
2012-12-08 14:38:06.883 DT[25684:303] Attribute created: Attribute color: (
YELLOW,
PURPLE
)
2012-12-08 14:38:06.884 DT[25684:303] Attribute created: Attribute size: (
LARGE,
SMALL
)
However, if I create a NSMutableArray and place several attribute objects in it, I get this output when I print the array in the same manner:
2012-12-08 14:38:06.887 DT[25684:303] Attributes: (
"Attribute color: (\n YELLOW,\n PURPLE\n)",
"Attribute size: (\n LARGE,\n SMALL\n)",
)
Why does it print the newline character in this context, and how would I prevent it from doing so?