Re: why can't I see my layer?
Re: why can't I see my layer?
- Subject: Re: why can't I see my layer?
- From: Memo Akten <email@hidden>
- Date: Fri, 13 Mar 2009 13:11:25 +0000
for others reading this on the archives, I found the problem, I need
to set the bounds (or frame) for titleLayer.
On 13 Mar 2009, at 12:09, Memo Akten wrote:
I have a simple setup below, but I can't see my text layer, what am
I missing?
(also are all of the commented lines nessecary?)
view = [[[NSApplication sharedApplication] keyWindow] contentView];
rootLayer = [CALayer layer];
[rootLayer setBounds: NSRectToCGRect(view.bounds)]; // is this
necessary?
[rootLayer setMasksToBounds:NO]; // or could I omit the line above
and just do this?
[rootLayer setPosition:CGPointMake(0, 0)]; // i guess this is not
needed?
CATextLayer *titleLayer = [CATextLayer layer];
titleLayer.string = @"testing this";
titleLayer.font = [NSFont fontWithName:@"Myriad Set" size:20];
titleLayer.foregroundColor = CGColorCreateGenericRGB(.2, .3, .9, 1.0);
[rootLayer addSublayer:titleLayer];
[view setLayer:rootLayer];
[view setWantsLayer:YES];
[view setNeedsDisplay:YES]; // is this necessary?
[rootLayer setNeedsDisplay]; // is this necessary?
instead of adding titleLayer to rootLayer, if I directly do
view.layer = titleLayer I can see it (so nothing wrong with
titleLayer), but obviously then I can't add more stuff, I need to
add stuff to the root...
Cheers,
Memo.
_______________________________________________
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
_______________________________________________
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