Confusing CALayer Transform/Frame/Bounds Behavior
Confusing CALayer Transform/Frame/Bounds Behavior
- Subject: Confusing CALayer Transform/Frame/Bounds Behavior
- From: Seth Willits <email@hidden>
- Date: Tue, 24 Jan 2012 16:23:06 -0800
I'm trying to get a handle on how changing the frame of a layer affects its frame while a transform is specified. During this, I noticed something weird, and I just can't figure it out.
In the documentation:
"When a new frame rectangle is specified the bounds origin is undisturbed, while the bounds size is set to the size of the frame."
However, I'm not seeing this as being the case.
// Step 1 --------------------
CALayer * layer = [CALayer layer];
layer.frame = CGRectMake(50, 50, 500, 500);
// Step 2 --------------------
layer.transform = CATransform3DMakeRotation(M_PI_4, 0, 0, 1.0);
// frame: {{-53.5…, -53.5…}, {707.1…, 707.1…}}
// bounds: {{0, 0}, {500, 500}}
// Step 3 --------------------
layer.frame = layer.frame;
// frame: {{-53.5…, -53.5…}, {707.1…, 707.1…}}
// bounds: {{0, 0}, {1000, 0}}
So first of all, I find it a bit odd that setting the frame to its current value changes the bounds at all, but I can imagine that it somehow makes sense given the transform is applied. But more importantly, how does it make any sense that the bounds is changing size to 1000 x 0?
See it in action:
http://www.sethwillits.com/temp/CATransformDemo.mov
Can anyone explain what's going on?
--
Seth Willits
_______________________________________________
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