How to replace image contents?
How to replace image contents?
- Subject: How to replace image contents?
- From: Samvel <email@hidden>
- Date: Wed, 9 Apr 2008 21:43:41 -0500
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 (email@hidden)
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:
This email sent to email@hidden