• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
How to replace image contents?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Follow-Ups:
    • Re: How to replace image contents?
      • From: Bill Bumgarner <email@hidden>
  • Prev by Date: Re: Override AppleScrollBarVariant on NSScroller?
  • Next by Date: Re: How to replace image contents?
  • Previous by thread: IKImageView -zoomImageToFit causes flicker
  • Next by thread: Re: How to replace image contents?
  • Index(es):
    • Date
    • Thread