FROM : Troy Stephens
DATE : Mon Jan 14 20:24:43 2008
On Jan 14, 2008, at 9:35 AM, Thomas Bartelmess wrote:
> Hello i,ve got an object, like that:
>
> @implementation topBar
>
> - (id)initWithFrame:(NSRect)frame {
> self = [super initWithFrame:frame];
> if (self) {
>
> }
> return self;
> }
>
> - (void)drawRect:(NSRect)rect {
>
>
> NSGradient* topBarGradient = [[[NSGradient alloc]
> initWithStartingColor:[NSColor colorWithDeviceRed:0.7 green:0.7 blue:
> 0.7 alpha:1.0] endingColor:[NSColor colorWithDeviceRed:0.9 green:0.9
> blue:0.9 alpha:1.0]] autorelease];
>
> NSRect rect1 = NSMakeRect ( 0,0,[self bounds].size.width,30 );
> [topBarGradient drawInRect:rect1 angle:90];
>
> }
>
> when turn on Core Animation Rendering (setWantsLayer:true) there is
> no gardient, just a white box
That's strange. What you describe works just fine for me. (The
gradient draws the same, whether the view is layer-backed or not, as
it should.)
Is there anything else involved in the implementation of the view that
you omitted from this code sample? I don't know of any problems that
would cause the symptom you're seeing, but if you can provide a test
project that reproduces the problem, by all means please send me a copy.
Thanks,
Troy
--
Troy Stephens
Cocoa Frameworks
Apple, Inc.
DATE : Mon Jan 14 20:24:43 2008
On Jan 14, 2008, at 9:35 AM, Thomas Bartelmess wrote:
> Hello i,ve got an object, like that:
>
> @implementation topBar
>
> - (id)initWithFrame:(NSRect)frame {
> self = [super initWithFrame:frame];
> if (self) {
>
> }
> return self;
> }
>
> - (void)drawRect:(NSRect)rect {
>
>
> NSGradient* topBarGradient = [[[NSGradient alloc]
> initWithStartingColor:[NSColor colorWithDeviceRed:0.7 green:0.7 blue:
> 0.7 alpha:1.0] endingColor:[NSColor colorWithDeviceRed:0.9 green:0.9
> blue:0.9 alpha:1.0]] autorelease];
>
> NSRect rect1 = NSMakeRect ( 0,0,[self bounds].size.width,30 );
> [topBarGradient drawInRect:rect1 angle:90];
>
> }
>
> when turn on Core Animation Rendering (setWantsLayer:true) there is
> no gardient, just a white box
That's strange. What you describe works just fine for me. (The
gradient draws the same, whether the view is layer-backed or not, as
it should.)
Is there anything else involved in the implementation of the view that
you omitted from this code sample? I don't know of any problems that
would cause the symptom you're seeing, but if you can provide a test
project that reproduces the problem, by all means please send me a copy.
Thanks,
Troy
--
Troy Stephens
Cocoa Frameworks
Apple, Inc.
| Related mails | Author | Date |
|---|---|---|
| Thomas Bartelmess | Jan 14, 18:35 | |
| Troy Stephens | Jan 14, 20:24 |






Cocoa mail archive

