• 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: image opacity?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: image opacity?


  • Subject: Re: image opacity?
  • From: Jim Puls <email@hidden>
  • Date: Sun, 11 May 2008 12:11:46 -0700

On May 11, 2008, at 1:26 AM, Michael Vannorsdel wrote:

On May 11, 2008, at 1:03 AM, Patrick J. Collins wrote:

Does anyone happen to know how one could set the opacity of an
NSImageView object? I am looking for a way to simply fade in an image
on within my app's window-- but neither of the NSImageView nor
IKImageView list anything about opacity...


NSView and subclasses have a setAlphaValue: that might do what you want. It requires a backing Core Animation layer (CALayer) and therefore is Leopard only. You can have IB setup the layer backing by setting the view's Wants Core Animation Layer under Effects of the Inspector window; I think Content View is the one to enable it on. You can do it programatically with setWantsLayer:YES as well. Then you use the animator proxy like:

[[NSAnimationContext currentContext] setDuration:2.0]; //2 second fade
[[imageView animator] setAlphaValue:1.0f]; //fade in view to full opacity


Alternately you can subclass the NSImageView or make your own NSView subclass and override drawRect: to vary the drawn image's opacity. If you're adventurous you can use Core Image to do an accelerated fade for Tiger and up.

Or, for the particular case of fading in and out, you can always use NSViewAnimation: http://developer.apple.com/documentation/Cocoa/Reference/ApplicationKit/Classes/NSViewAnimation_Class/Reference/Reference.html


-> jp

Attachment: smime.p7s
Description: S/MIME cryptographic signature

_______________________________________________

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

References: 
 >image opacity? (From: "Patrick J. Collins" <email@hidden>)
 >Re: image opacity? (From: Michael Vannorsdel <email@hidden>)

  • Prev by Date: Re: Update slider position
  • Next by Date: Custom Font Chooser
  • Previous by thread: Re: image opacity?
  • Next by thread: Re: Sleep Display
  • Index(es):
    • Date
    • Thread