Re: CALayer and frame
Re: CALayer and frame
- Subject: Re: CALayer and frame
- From: Scott Anguish <email@hidden>
- Date: Sat, 26 Jan 2008 01:34:13 -0500
file a bug on the doc and I'll run it by engineering...
On Jan 26, 2008, at 1:11 AM, Francisco Tolmasky wrote:
That's actually what I did, I just shortened it for this mailing
list. Needless to say, both give the same result.
BTW, the layer in question has the following transform applied to it:
CGAffineTransformRotate
(CGAffineTransformScale(CGAffineTransformMakeRotation(-M_PI / 4.0),
4.0, 2.0), M_PI / 4)
The complete test code is as follows:
[layer
setAffineTransform:CGAffineTransformRotate
(CGAffineTransformScale(CGAffineTransformMakeRotation(-M_PI / 4.0),
4.0, 2.0), M_PI / 4)];
layer.frame = CGRectMake(0.0, 0.0, 200.0, 200.0);
// log this
layer.frame = layer.frame;
// log this
CGRect frame = layer.frame;
layer.frame = frame;
// log this.
If you log those three you get the following:
{{-100, -100}, {400, 400}}
{{-300, -300}, {800, 800}}
{{-700, -700}, {1600, 1600}}
As you can see, each additional setting of the frame back to itself
doubles the size of the view.
This is what leads me to believe that the definition of "frame" in
[CALayer setFrame:] (i.e. .frame = )
is different than [CALayer frame] (i.e. = .frame).
Francisco
On Jan 25, 2008, at 10:01 PM, Scott Anguish wrote:
try setting it to a temporarily rectangle an then back to the
origional
temprect=thelayer.frame
thelayer.frame=temprect
see if that gives you the origional frame??
On Jan 26, 2008, at 12:08 AM, Francisco Tolmasky wrote:
Right, but I'm trying to interpret what the derived property means
in both cases.
It seems very strange that it gets "constructed" differently than
it gets
"desconstructed" (hence myLayer.frame = myLayer.frame changing the
object).
Francisco
On Jan 25, 2008, at 7:53 PM, Bill Dudney wrote:
Hi Francisco,
The frame is a derived property. Its a combination of position
and bounds, so when you call setFrame: its really setting the
bounds and position. When you call frame its using position and
bounds to make a new rect.
HTH,
-bd-
http://bill.dudney.net/roller/objc
On Jan 25, 2008, at 8:28 PM, Francisco Tolmasky wrote:
I'm wondering if someone can clear up my suspicions with
CALayer's frame property.
Essentially, my confusion stems from the fact that doing:
myLayer.frame = myLayer.frame
*changes* the frame of the myLayer. From what I can perceive,
it would appear that
[myLayer frame] returns the bounding box of the layer (the
smallest rect that could
contain it), but [myLayer setFrame:] just sets the bounds equal
to the frames size/width
and adjusts the anchor point. Is this correct?
Thanks,
Francisco
_______________________________________________
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
_______________________________________________
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:
@cocoadoc.com
This email sent to email@hidden
_______________________________________________
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