2009-12-01 92 views
11

请向我解释什么是initWithCoder?什么是initWithCoder?

谢谢。

+2

http://developer.apple.com/mac/library/documentation/cocoa/Reference/Foundation/Protocols/NSCoding_Protocol/Reference/Reference.html#//apple_ref/occ/intfm/NSCoding/initWithCoder: – Sampson 2009-12-01 22:48:07

回答

9

initWithCoder:NSCoder协议的一部分,它是Cocoa序列化系统的一部分。阅读Archives and Serializations Guide for Cocoa

+1

when initWithCoder会调用还是什么事件? – domlao 2009-12-01 23:12:26

+4

当您从磁盘上的文件反序列化某些内容时,它会被调用。 NSCoder是用于创建和读取包含类的对象的持久性存储(文件)的协议。 'initWithCoder'使用文件中的数据创建一个对象。 – TechZen 2009-12-02 00:02:20

相关问题