CALayer Grid jerky animation
CALayer Grid jerky animation
- Subject: CALayer Grid jerky animation
- From: "Mazen M. Abdel-Rahman" <email@hidden>
- Date: Mon, 29 Mar 2010 13:58:58 -0700
Hi All,
I have a grid of equal sized CALayers in a parent layer - in my case it's a calendar grid - but it could also be a chess board for example.
After adding all the cell (child) layers to the parent layer I iterate through them again to add constraints.
The parent layer can have it's width resized. The height is constant.
For all cell layers I added the following constraint:
[cellLayer addConstraint:[CAConstraintconstraintWithAttribute:kCAConstraintWidth relativeTo:@"superlayer"
attribute:kCAConstraintWidth
scale:(1/numColumns)
offset:0]];
so that as the parent layer is resized all the child layers are resized as well.
For all layers except those in the right most column I add the following constraint:
[cellLayer addConstraint:[CAConstraint constraintWithAttribute:kCAConstraintMaxX
relativeTo:[rightLayer name]
attribute:kCAConstraintMinX
offset:0]];
so that each layer's right edge is always touching the left edge of the layer to it's right.
Finally - the layers in the right most column are constrained by:
[cellLayer addConstraint:[CAConstraint constraintWithAttribute:kCAConstraintMaxX
relativeTo:@"superlayer"
attribute:kCAConstraintMaxX
offset:0]];
so that their right edge always matches the right edge of the parent layer.
My problem is that when the parent layer is resized the animation of the layers being resized/moved is jerky. The child layers are moved/resized after the parent layer is finished resizing. Is there a way to make this smoother? I would love to copy how iCal does it - where the rectangles (which I assume are CALayers) containing the appointments are smoothly resized as the iCal window is being resized.
Thanks!
Mazen Abdel-Rahman
_______________________________________________
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