I have one costum object which has a reference to another custom object. How do I encode the custom object within the one custom object in my - (void)encodeWithCoder:(NSCoder *)encoder
method?
Lets say name is a string an cObj is another custom obj:
- (void)encodeWithCoder:(NSCoder *)encoder {
[encoder encodeObject:self.name forKey:@"name"];
[encoder encodeObject:self.cObj forKey:@"cObj"];
}
Does this will call - (void)encodeWithCoder:(NSCoder *)encoder
in my other custom object?
Thank you.
cObj需要支持<NSCoding>
,所以可以。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.