Ideally an NSCoding compliant class will work as expected using encodeWithCoder: and initWithCoder: (at least I thought so till recently) without the developer having to bot
The documentation is misleading -- UIImage does not conform to NSCoding as you've stated. You can work around it (in a primitive way) by doing the work yourself:
@interface UIImage (NSCoding)
- (id)initWithCoder:(NSCoder *)decoder;
- (void)encodeWithCoder:(NSCoder *)encoder;
@end
@implementation UIImage (NSCoding)
- (id)initWithCoder:(NSCoder *)decoder {
NSData *pngData = [decoder decodeObjectForKey:@"PNGRepresentation"];
[self autorelease];
self = [[UIImage alloc] initWithData:pngData];
return self;
}
- (void)encodeWithCoder:(NSCoder *)encoder {
[encoder encodeObject:UIImagePNGRepresentation(self) forKey:@"PNGRepresentation"];
}
@end