Joe, I don't see you setting the needDisplayOnBoundsChange property, thus:

layer.needDisplayOnBoundsChange = YES;

The default value for this property is NO.

-Michael
----------------------
We know as much about software quality problems as they knew about the Black Plague in the 1600s. We've seen the victims' agonies and helped burn the corpses. We don't know what causes it; we don't really know if there is only one disease. We just suffer - and keep pouring our sewage into our water supply.

-- Unknown

On Jan 21, 2009, at 5:10 AM, Joe Wildish wrote:

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/michaelacrawford%40mac.com

This email sent to michaelacrawf...@mac.com

Attachment: smime.p7s
Description: S/MIME cryptographic signature

_______________________________________________

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