按照NSCoding协议,在类定义中添加编码方法encodeWithCoder:方法和解码方法initWithCoder:方法实现的。
对于基本objective-C类(NSString、NSArray、NSDictionary、NSSet、NSDate、NSNumber、NSData)使用encodeObject:forKey:编码方法和decodeObject:forKey解码方法。
按照NSCoding协议,在类定义中添加编码方法encodeWithCoder:方法和解码方法initWithCoder:方法实现的。
对于基本objective-C类(NSString、NSArray、NSDictionary、NSSet、NSDate、NSNumber、NSData)使用encodeObject:forKey:编码方法和decodeObject:forKey解码方法。