打印中文

#import 

@interface NSArray (MyLog)

@end

@interface NSDictionary (MyLog)

@end



#import "NSArray+MyLog.h"

@implementation NSArray (MyLog)


/* 打印中文 */


- (NSString*)descriptionWithLocale:(id)locale {
    
    NSMutableString*str = [NSMutableString stringWithString:@"(\n"];
    
    [self enumerateObjectsUsingBlock:^(id obj,NSUInteger idx,BOOL*stop) {
        
        [str appendFormat:@"\t%@,\n", obj];
        
    }];
    
    [str appendString:@")"];
    
    return str;
    
}

@end

@implementation NSDictionary (MyLog)

- (NSString*)descriptionWithLocale:(id)locale {
    
    NSMutableString*str = [NSMutableString stringWithString:@"{\n"];
    
    [self enumerateKeysAndObjectsUsingBlock:^(id key,id obj,BOOL*stop) {
        
        [str appendFormat:@"\t%@ = %@;\n", key, obj];
        
    }];
    
    [str appendString:@"}\n"];
    
    return str;
    
}

@end




你可能感兴趣的:(项目实用,iOS,打印中文)