I think my understanding of NSGradient's use may be off here....

I'm trying to create a custom NSView that uses NSGradient to shade the view in such a way that it mimics Apple's two-tints NSView. You can see the color scheme at the bottom left hand corner of Mail and the NSView at the bottom of Automator (I'm sure there are other apps, but I can't figure out which ones they are).

Here's the code I'm using for -drawRect:

- (void)drawRect:(NSRect)rect {
    // Drawing code here.
    NSArray *_colorArray = [NSArray arrayWithObjects:
[NSColor colorWithDeviceRed:0.9843 green: 0.9843 blue:0.9843 alpha:1.0], [NSColor colorWithDeviceRed:0.9608 green: 0.9608 blue:0.9608 alpha:1.0], [NSColor colorWithDeviceRed:0.8824 green: 0.8824 blue:0.8824 alpha:1.0],
                            nil];

NSGradient *_gradient = [[NSGradient alloc] initWithColors:_colorArray];
    [_gradient drawInRect:rect angle:90];
    [_gradient release];
}

Am I using the right NSGradient method? Is it the right angle?

I tried using -drawFromPoint:toPoint:options:, but that didn't work, either. Any ideas?

Live Playfully,

Sam
-----
If he listens in faith,
finding no fault, a man is free
and will attain the cherished words
of those who act in virtue.

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to