why can't I see my layer?
why can't I see my layer?
- Subject: why can't I see my layer?
- From: Memo Akten <email@hidden>
- Date: Fri, 13 Mar 2009 12:09:43 +0000
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