Why is CAConstraint not working?
So you’re having problems with CAConstraint? It seems like no matter what you do the Constraint isn’t being applied to the Sublayer? And you’re CALayers are appearing in weird positions? Or not appearing at all?
Well the answer for me is surprisingly simple (and embarrassing)
1 2 3 4 | [sublayer addConstraint: [CAConstraint constraintWithAttribute:kCAConstraintMidX relativeTo:@"superlayer" attribute:kCAConstraintMidX]] |
Now see that that @”superlayer”? Notice that it’s not a Uppercase “L” as I was using “superLayer” where upon Core Animation was unable to find the layer “superLayer” and therefore have nothing to do with the constraints.
Tags: CAConstraint, Core Animation
Comments are closed.
