Dear list,
I have a layer backed view whose layer contains many sublayers. The problem is
that the layer doesn't get drawn in the view when the app starts. If I resize
the window, then the layer and all its sublayers draw properly. I've solved
this problem before with what seemed like a magic collection of [calayer
setNeedsDisplay] and [view setNeedsDisplay:YES], but this time I can't seem to
get it to work. Therefore, I thought I'd ask if anyone knows the correct way to
do this.
My view subclass makes its layers like this:
- (void) setupLayers
{
NSLog(@"Setting up layers");
CALayer *rootLayer = [CALayer layer];
rootLayer.layoutManager = [CAConstraintLayoutManager layoutManager];
[self setLayer:rootLayer];
[self setWantsLayer:YES];
yearLayer = [[CAYearLayer alloc] initWithDate:self.year
dataSource:self.datasource];
[rootLayer addSublayer:yearLayer];
[rootLayer setNeedsDisplay];
[self setNeedsDisplay:YES];
}
and the setupLayers is called in awakeFromNib of the view subclass.
Any hints gratefully received.
Martin
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Martin Hewitson
Albert-Einstein-Institut
Max-Planck-Institut fuer
Gravitationsphysik und Universitaet Hannover
Callinstr. 38, 30167 Hannover, Germany
Tel: +49-511-762-17121, Fax: +49-511-762-5861
E-Mail: [email protected]
WWW: http://www.aei.mpg.de/~hewitson
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
_______________________________________________
Cocoa-dev mailing list ([email protected])
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 [email protected]