Re: NSURL Tutorial?
Re: NSURL Tutorial?
- Subject: Re: NSURL Tutorial?
- From: Jeff LaMarche <email@hidden>
- Date: Sun, 28 Oct 2001 20:26:30 -0800
On Sunday, October 28, 2001, at 04:30 PM, Scott Anguish wrote:
At 2:14 PM -0800 10/28/01, Steven W. Riggins wrote:
imageData = [NSData dataWithContentsOfURL:imageURL];
[imageData retain];
image = [[NSImage alloc] initWithData:imageData];
[SNIP]
Well, give the above, I think that you're probably dealing with
the imageData being retained when it doesn't need to be as well.
NSImage initWithData doesn't appear to require that the data be
retained when it is passed to it.
I probably should have clarified here that I retain the NSData object
for other purposes and take care of cleaning it up in my dealloc object.
By keeping around a reference to the original data, it makes it a lot
easier to save the image to a file, etc.
I probably should have deleted the line of code when I pasted it into my
e-mail, or clarified that it wasn't necessary in most instances where
you would do that.