1
CATransform3D가 제대로 작동하지 않습니다. 아래 코드를 사용하고 있습니다. 내 문제는 만약 내가 변환 잘하면 잘 작동합니다. 손가락을 뗀 다음 이미지를 더 변형 시키면 이미지가 초기 이미지로 이동합니다. 마지막 변환을 설정하는 방법? 변환을 위해 PanGesture를 사용하고 있습니다. 아이디어 좀주세요. 미리 감사드립니다.CATransform3D가 제대로 작동하지 않습니다.
if ([recognizer respondsToSelector:@selector(translationInView:)]) {
CGPoint translation = [(UIPanGestureRecognizer *)recognizer translationInView:recognizer.view.superview];
CALayer *layer = self.layer;
CATransform3D rotationAndPerspectiveTransform = CATransform3DIdentity;
rotationAndPerspectiveTransform.m34 = 1.0/-500;
rotationAndPerspectiveTransform = CATransform3DRotate(rotationAndPerspectiveTransform, translation.x * M_PI/180.0f, 0.0f, 1.0f, 0.0f);
layer.transform = rotationAndPerspectiveTransform;
rotationAndPerspectiveTransform.m34 = 1.0/-500;
rotationAndPerspectiveTransform = CATransform3DRotate(rotationAndPerspectiveTransform, -translation.y * M_PI/180.0f, 1.0f, 0.0f, 0.0f);
layer.transform = rotationAndPerspectiveTransform;
}