CALayer autoresizing behaviour
CALayer autoresizing behaviour
- Subject: CALayer autoresizing behaviour
- From: Joe Wildish <email@hidden>
- Date: Wed, 21 Jan 2009 13:10:00 +0000
All,
I'm having trouble getting a CALayer to resize automatically to fill
its superlayer. I have the following code snippet:
layer = [CALayer layer];
layer.layoutManager = [CAConstraintLayoutManager layoutManager];
layer.autoresizingMask = kCALayerWidthSizable |
kCALayerHeightSizable;
object.frame = CGRectMake(0.0f, 0.0f, 100.0f, 100.0f);
[object addSublayer:layer];
NSLog(@"object.frame=%@,\nlayer.frame=%@",
NSStringFromRect(NSRectFromCGRect(object.frame)),
NSStringFromRect(NSRectFromCGRect(layer.frame)));
(NB: "object" is an instance of a CALayer).
It was my understanding that with the options that I've used for the
autoresizing mask on "layer", it should be resized to be the same size
as its super-layer. However, the output on the console indicates
otherwise:
2009-01-21 13:03:31.538 TheAppName[37894:10b] object.frame={{0, 0},
{100, 100}},
layer.frame={{0, 0}, {0, 0}}
I thought that it might be that the change was in a state of animation
at the point of the NSLog, but the actual visual output I'd expect
from my app also indicates that the resize hasn't occurred.
Is anyone able to point out what I'm doing wrong?
Many thanks,
-Joe
_______________________________________________
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