2012-04-06 13 views

Respuesta

24

Si se hereda de una clase que admite la codificación, es generalmente adviseable utilizar [super encodeWithCoder:] en su método encodeWithCoder:, tanto como [super initWithCoder:] se va a utilizar en el método initWithCoder:.

Documentación:NSCoding Protocol Reference

Referencia:http://www.cocoadev.com/index.pl?NSCoder

si la clase hereda de una clase que se ajusta a (NSObject no se ajusta), entonces debería incluir la [encodeWithCoder:] método.

// <NSCoding> protocol methods 

-(void)encodeWithCoder:(NSCoder*)coder 
{ 
    [super encodeWithCoder:coder]; 
    /* 
    [coder encodeObject: theNSStringInstanceVariable]; 
    [coder encodeObject: theNSDictionaryInstanceVariable]; 
    [coder encodeValueOfObjCType:@encode(BOOL) at:&theBooleanInstanceVariable]; 
    [coder encodeValueOfObjCType:@encode(float) at:&theFloatInstanceVariable]; 
    */ 
} 
+2

Gracias mucho :) – XaitormanX

+0

@XaitormanX De nada, mi amigo! :-) –

Cuestiones relacionadas