Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Gradient panel



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:
http://lists.apple.com/mailman/options/cocoa-dev/email@hidden

This email sent to email@hidden
References: 
 >Gradient panel (From: David <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.