문제

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?

도움이 되었습니까?

해결책

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top