• 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
Re: NSImage initWithContentsOfURL:
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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] initWithData:[myURL resourceDataUsingCache:YES]];

-Michael


  • Follow-Ups:
    • Re: NSImage initWithContentsOfURL:
      • From: Louis Demers <email@hidden>
  • Prev by Date: Re: Any advantages of Unix formatting
  • Next by Date: A question about [NSImage initByReferencingFile:filename]
  • Previous by thread: Re: NSImage initWithContentsOfURL:
  • Next by thread: Re: NSImage initWithContentsOfURL:
  • Index(es):
    • Date
    • Thread