Ios 序列图像板initWithCoder正常,但何时调用EncodWithCoder

Ios 序列图像板initWithCoder正常,但何时调用EncodWithCoder,ios,xcode,Ios,Xcode,我正在试验故事板和NSCoder。当从情节提要加载ViewController时,调用initWithCoder 如何以及何时调用编码器?我猜这是通过故事板加载其他视图或处理ViewController完成的。我尝试在包含encodeWithCoder方法的ViewController上解除ViewControllerAnimated 有什么想法吗 谢谢当一个对象被序列化为字节流时,会调用encodeWithCode,这样它就可以被写入磁盘/通过网络发送等等。。。对于故事板,它永远不会被调用,因

我正在试验故事板和NSCoder。当从情节提要加载ViewController时,调用initWithCoder

如何以及何时调用编码器?我猜这是通过故事板加载其他视图或处理ViewController完成的。我尝试在包含encodeWithCoder方法的ViewController上解除ViewControllerAnimated

有什么想法吗


谢谢

当一个对象被序列化为字节流时,会调用encodeWithCode,这样它就可以被写入磁盘/通过网络发送等等。。。对于故事板,它永远不会被调用,因为它永远不会写入磁盘,只从磁盘读取

encodeWithCoder实际上是initWithCoder的“反面”