Skip navigation.
 
mlFYI: Bug with archived NSShadow objects
FROM : Ricky Sharp
DATE : Tue Dec 07 18:20:13 2004

I just filed the following bug:

<rdar://3908770>

I've found that under Mac OS X 10.3.6 (I haven't had the chance to explore other versions), that the x-offset value of an NSShadow is either not being decoded correctly.  When decoding, you always get a value of 0.  It could be the case where the encoding side of things is at fault though.

A workaround involves not coding/decoding the NSShadow directly (which should have worked since it conforms to NSCoding).  Instead, code/decode the individual attributes.

So instead of:

    [coder encodeObject:[self textShadow] forKey:@"MyTextShadow"];

you'd use:

    NSShadow* theTextShadow = [self textShadow];

    [coder encodeObject:[theTextShadow shadowColor] forKey:@"MyTextShadowColor"];
    [coder encodeFloat:[theTextShadow shadowBlurRadius] forKey:@"MyTextShadowBlurRadius"];
    [coder encodeFloat:[theTextShadow shadowOffset].width forKey:@"MyTextShadowXOffset"];
    [coder encodeFloat:[theTextShadow shadowOffset].height forKey:@"MyTextShadowYOffset];

You'd do something similar when decoding.

--
Rick Sharp
Instant Interactive(tm)

Related mailsAuthorDate
mlFYI: Bug with archived NSShadow objects Ricky Sharp Dec 7, 18:20
mlRe: FYI: Bug with archived NSShadow objects Ricky Sharp Dec 7, 19:45