Jus*_*kva 6 objective-c nslog nsarray
我有以下方法:
- (NSString *)description {
return [NSString stringWithFormat:@"Attribute %@: %@", name, [values description]];
}
Run Code Online (Sandbox Code Playgroud)
Name是一个字符串,values是NSArray.我有一个包含其中几个对象的NSArray.
当我使用NSLog(@"Attribute created: %@", [newAttribute description]);
它打印属性工作正常,并打印此:
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
)
Run Code Online (Sandbox Code Playgroud)
但是,如果我创建一个NSMutableArray并在其中放置几个属性对象,当我以相同的方式打印数组时,我得到此输出:
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)",
)
Run Code Online (Sandbox Code Playgroud)
为什么在此上下文中打印换行符,我将如何阻止它?
归档时间: |
|
查看次数: |
2234 次 |
最近记录: |