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