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 (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