• 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: Putting an image on a CALayer
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Putting an image on a CALayer


  • Subject: Re: Putting an image on a CALayer
  • From: douglas welton <email@hidden>
  • Date: Tue, 21 Oct 2008 16:13:32 -0400


On Oct 21, 2008, at 4:00 PM, DKJ wrote:

OK, I tried this:

NSURL *url = [NSURL fileURLWithPath:fname];
CGImageSourceRef source = CGImageSourceCreateWithURL((CFURLRef)url, NULL);
CGImageRef image = CGImageSourceCreateImageAtIndex(source, 0, NULL);
CFRelease(source);

theView.layer.contents = image;


and now I get an incompatible pointer type warning on the last line. But the CALayer contents property has an id type.

change your line of code to:

	theView.layer.contents = (id)image;

And in any case, why is putting an image on a layer such an involved process?

pardon me, but why do you think that typing 3 lines* of code is an "involved process"? Is there something about ImageIO or the exact nature of a layer's content that you don't understand or was not clear in the Core Animation Programming Guide?


curiously,

douglas

* the CFRelease() doesn't really count... it's memory management and doesn't really (directly) affect the layer content.
_______________________________________________


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: Putting an image on a CALayer
      • From: glenn andreas <email@hidden>
References: 
 >Putting an image on a CALayer (From: DKJ <email@hidden>)
 >Re: Putting an image on a CALayer (From: Jean-Daniel Dupas <email@hidden>)
 >Re: Putting an image on a CALayer (From: David Duncan <email@hidden>)
 >Re: Putting an image on a CALayer (From: DKJ <email@hidden>)

  • Prev by Date: Re: Putting an image on a CALayer
  • Next by Date: Re: Putting an image on a CALayer
  • Previous by thread: Re: Putting an image on a CALayer
  • Next by thread: Re: Putting an image on a CALayer
  • Index(es):
    • Date
    • Thread