NSArray+Log.m
1 #import "NSArray+Log.h" 2 3 @implementation NSArray (Log) 4 5 - (NSString *)descriptionWithLocale:(id)locale 6 { 7 // 遍历数组中的所有内容,将内容拼接成一个新的字符串返回 8 NSMutableString *strM = [NSMutableString string]; 9 10 [strM appendString:@"( "]; 11 12 // 遍历数组,self就是当前的数组 13 for (id obj in self) { 14 // 在拼接字符串时,会调用obj的description方法 15 [strM appendFormat:@" %@, ", obj]; 16 } 17 18 [strM appendString:@")"]; 19 20 return strM; 21 } 22 23 @end