Re: NSImage initWithContentsOfURL:
Re: NSImage initWithContentsOfURL:
- Subject: Re: NSImage initWithContentsOfURL:
- From: Michael Meisel <email@hidden>
- Date: Tue, 4 Sep 2001 04:02:55 -0700
On Tuesday, September 4, 2001, at 01:33 AM, Scott Anguish wrote:
On Monday, September 3, 2001, at 07:59 PM, Matt Judy wrote:
is an outlet to an NSImageView. myImage is not getting drawn into
imageView.
The NSLog for myImageURL returns a URL to an image, which I can verify
in a web browser.
The NSLog for myImage returns (null). This seems fairly
straightforward... What am I
doing wrong?
I thought that many areas of AppKit still only worked with NSURLs of the
file:// type. Is this one of those places?
Yes, that appears to be the case. You can use this code to init your
image properly:
NSURL *myURL = [NSURL URLWithString:myImageURL];
NSImage *myImage = [[NSImage alloc] initWith
Data:[myURL
resourceDataUsingCache:YES]];
-Michael