Question

I'm using CALayer for interactive book engine and want to rotate CALayer around it center but when I apply rotation transform (using angle which is based on user input) to CALayer it goes crazy: layer stretches and moves in very strange way and disappears. What I do is

[CATransaction begin];
[CATransaction setValue: (id) kCFBooleanTrue forKey: kCATransactionDisableActions];
...
layer.transform = CATransform3DMakeRotation(angle, 0, 0, 1);
...
[CATransaction commit];

Interestingly, when my angle is M_PI or M_PI/2, or it's scale transform everything is ok, but when its rotation and any other angles layer goes crazy.

Does anybody know what's happening and how to fix it?

Était-ce utile?

La solution

Found the reason myself: it was because in parallel I moved layer using .frame instead of .position property: frame property itself is calculated based on transform thus setting it produced that 'crazy' behavior.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top