1,新建一个乱码文件的category分类文件
2.然后堆descriptionWithLocale函数进行重写。
例如:
-
- @interface NSArray (chinese)
- //local是你定义的数组同下
- - (NSString *)descriptionWithLocale:(id)locale;
-
- @end
-
- @interface NSDictionary (chinese)
-
- - (NSString *)descriptionWithLocale:(id)locale;
-
- @end
-
- @implementation NSArray (chinese)
-
- - (NSString *)descriptionWithLocale:(id)locale
- {
-
-
- NSMutableString *strM = [NSMutableString string];
- [strM appendString:@"(\n"];
-
- for (id obj in self) {
- [strM appendFormat:@"\t\t%@,\n", obj];
- }
- [strM appendString:@")"];
-
- return strM;
- }
-
-
-
- @end
-
-
- @implementation NSDictionary (chinese)
-
- - (NSString *)descriptionWithLocale:(id)locale
- {
-
- NSMutableString *strM = [NSMutableString string];
- [strM appendString:@"{\n"];
-
- for (id obj in [self allKeys]) {
- [strM appendFormat:@"\t\t%@,", obj];
-
- [strM appendFormat:@"%@\n", self[obj]];
- }
-
- [strM appendString:@"}"];
-
- return strM;
- }
-
-
- @end
-