From 3e8437ae559487362fae3525beb79c534c213a51 Mon Sep 17 00:00:00 2001
From: 单军华
Date: Thu, 12 Jul 2018 13:44:34 +0800
Subject: [PATCH] bug修复和功能优化

---
 screendisplay/Pods/MJExtension/MJExtension/NSObject+MJCoding.m |   54 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 54 insertions(+), 0 deletions(-)

diff --git a/screendisplay/Pods/MJExtension/MJExtension/NSObject+MJCoding.m b/screendisplay/Pods/MJExtension/MJExtension/NSObject+MJCoding.m
new file mode 100755
index 0000000..27ae8ee
--- /dev/null
+++ b/screendisplay/Pods/MJExtension/MJExtension/NSObject+MJCoding.m
@@ -0,0 +1,54 @@
+//
+//  NSObject+MJCoding.m
+//  MJExtension
+//
+//  Created by mj on 14-1-15.
+//  Copyright (c) 2014��� ���������. All rights reserved.
+//
+
+#import "NSObject+MJCoding.h"
+#import "NSObject+MJClass.h"
+#import "NSObject+MJProperty.h"
+#import "MJProperty.h"
+
+@implementation NSObject (MJCoding)
+
+- (void)mj_encode:(NSCoder *)encoder
+{
+    Class clazz = [self class];
+    
+    NSArray *allowedCodingPropertyNames = [clazz mj_totalAllowedCodingPropertyNames];
+    NSArray *ignoredCodingPropertyNames = [clazz mj_totalIgnoredCodingPropertyNames];
+    
+    [clazz mj_enumerateProperties:^(MJProperty *property, BOOL *stop) {
+        // ���������������������
+        if (allowedCodingPropertyNames.count && ![allowedCodingPropertyNames containsObject:property.name]) return;
+        if ([ignoredCodingPropertyNames containsObject:property.name]) return;
+        
+        id value = [property valueForObject:self];
+        if (value == nil) return;
+        [encoder encodeObject:value forKey:property.name];
+    }];
+}
+
+- (void)mj_decode:(NSCoder *)decoder
+{
+    Class clazz = [self class];
+    
+    NSArray *allowedCodingPropertyNames = [clazz mj_totalAllowedCodingPropertyNames];
+    NSArray *ignoredCodingPropertyNames = [clazz mj_totalIgnoredCodingPropertyNames];
+    
+    [clazz mj_enumerateProperties:^(MJProperty *property, BOOL *stop) {
+        // ���������������������
+        if (allowedCodingPropertyNames.count && ![allowedCodingPropertyNames containsObject:property.name]) return;
+        if ([ignoredCodingPropertyNames containsObject:property.name]) return;
+        
+        id value = [decoder decodeObjectForKey:property.name];
+        if (value == nil) { // ���������������MJExtension������
+            value = [decoder decodeObjectForKey:[@"_" stringByAppendingString:property.name]];
+        }
+        if (value == nil) return;
+        [property setValue:value forObject:self];
+    }];
+}
+@end

--
Gitblit v1.8.0