Re: Gradient panel
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