Tôi đã đọc và cố gắng này article (Opening door effect using Core Animation)Làm thế nào để xoay một UIImageView với CATransform3DRotate làm cho một hiệu ứng như mở cửa?
Và tôi thực hiện sau mã trong ứng dụng của tôi:
CALayer *layer = threeHomeView.layer;
CATransform3D initialTransform = threeHomeView.layer.transform;
initialTransform.m34 = 1.0/-900;
[UIView beginAnimations:@"Scale" context:nil];
[UIView setAnimationDuration:3];
layer.transform = initialTransform;
CATransform3D rotationAndPerspectiveTransform = threeHomeView.layer.transform;
rotationAndPerspectiveTransform = CATransform3DRotate(rotationAndPerspectiveTransform
, 40.0f * M_PI/180.0f
, 0.0f
, 1.0f
, 0.0f);
layer.transform = rotationAndPerspectiveTransform;
[UIView setAnimationDelegate:self];
[UIView setAnimationDidStopSelector:@selector(threeHomeFlyOut)];
[UIView commitAnimations];
threeHomeView là một UIImageView.
CÂU HỎI CỦA TÔI LÀ: hình ảnh chỉ có thể xoay theo đường thẳng đứng giữa của hình ảnh, nhưng tôi muốn nó xoay theo đường thẳng đứng bên trái của hình ảnh.
Tôi gặp cùng một vấn đề và cố gắng thiết lập một hướng dẫn đúng đắn/giải thích sâu sắc hơn ở đây: http: // stackoverflow.com/questions/7685547/3d-door-open-animation-between-two-uiviewcontrollers –