My class contains an UIImage property which I want to enforce as a 'copy' property by any external clients accessing it. But, when I try to do a copy in my custom setter, I get the runtime error about UIImage not supporting copyWithZone. So what's a good way to ensure that the correct ownership policy is followed?
// declared in the interface as:
@property (nonatomic, readonly, copy) UIImage *personImage;
// class implementation
- (void)setPersonImage:(UIImage *)newImage
{
if (newImage != personImage)
{
[personImage release];
// UIImage doesn't support copyWithZone
personImage = [newImage copy];
}
}