Re: CALayer autoresizing behaviour
Re: CALayer autoresizing behaviour
- Subject: Re: CALayer autoresizing behaviour
- From: "Michael A. Crawford" <email@hidden>
- Date: Mon, 26 Jan 2009 14:06:42 -0800
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 (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
Attachment:
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________
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