Hi,

I have a class with image property:

@interface MyClass
{
        ...
        NSImage *image;
}

...

@end

in -(void) init: this image object is set like:

-(void) init
{
        ...
        image = [[NSImage alloc] initWithData: imageData];
        ...
}

somewhere else in another method image should be replaced with new data. Easiest way is to release and creation of new NSImage object like:

...
[image release];
image = [[NSImage alloc] initWithData: newImageData];
...

But these lines of code involves freeing memory and allocating new object although it seems to be faster if data would be replaced instead of recreating the whole object. Is it possible to do that way: just to replace image contents with newImageData without reallocating new object?

Thanks, Samvel.
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to