• 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: Gradient panel
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Gradient panel


  • Subject: Re: Gradient panel
  • From: Chris Hanson <email@hidden>
  • Date: Fri, 31 Oct 2008 21:05:23 -0700

On Oct 31, 2008, at 8:28 PM, David wrote:

Is NSGradient the key? Any examples of how you hook this in with a
panel or window?

NSGradient is, as you say, the key.

Remember that drawing in Cocoa takes place in a view; from that perspective, "Cocoa panel with a gradient background" isn't really a well-formed concept, because it's assuming the panel draws rather than its content view.

So just create your own custom subclass of NSView in which you override -drawRect: to render an NSGradient, and use an instance of it as your window/panel's content view. Or even just put it within your window/panel's content view, covering 100% of its area, with its springs and struts set appropriately.

  -- Chris

_______________________________________________

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: 
 >Gradient panel (From: David <email@hidden>)

  • Prev by Date: Gradient panel
  • Previous by thread: Gradient panel
  • Index(es):
    • Date
    • Thread