• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Confusing CALayer Transform/Frame/Bounds Behavior
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Follow-Ups:
    • Re: Confusing CALayer Transform/Frame/Bounds Behavior
      • From: David Duncan <email@hidden>
  • Prev by Date: Re: Where to implement alert ?
  • Next by Date: Re: Confusing CALayer Transform/Frame/Bounds Behavior
  • Previous by thread: Re: Programmatically create aliases to unmounted servers?
  • Next by thread: Re: Confusing CALayer Transform/Frame/Bounds Behavior
  • Index(es):
    • Date
    • Thread