English 中文(简体)
在 iview 上的视野变换
原标题:perspective transform on uiview

这里要开始的基本代码是:

[UIView transitionWithView:self.view duration:2.0
                   options:UIViewAnimationOptionBeginFromCurrentState
                animations:^ {         

                    CALayer *layer1 = leftband.layer;
                    layer1.anchorPoint = CGPointMake(0, 0.5);
                    CATransform3D rotationAndPerspectiveTransform1 = CATransform3DIdentity;
                    rotationAndPerspectiveTransform1.m34 = 1.0 / -500;
                    rotationAndPerspectiveTransform1 = CATransform3DRotate(rotationAndPerspectiveTransform1, DegreesToRadians(-180.0f), 0.0f, 1.0f, 0.0f);
                    layer1.transform = rotationAndPerspectiveTransform1;

                    CALayer *layer2 = rightband.layer;
                    layer2.anchorPoint = CGPointMake(0, 0.5);
                    CATransform3D rotationAndPerspectiveTransform2 = CATransform3DIdentity;
                    rotationAndPerspectiveTransform2.m34 = 1.0 / -500;
                    rotationAndPerspectiveTransform2 = CATransform3DRotate(rotationAndPerspectiveTransform2, DegreesToRadians(180.0f), 0.0f, 1.0f, 0.0f);
                    layer2.transform = rotationAndPerspectiveTransform2;
                }
                completion:nil {

                }];

左带和右带是两个 UIIMage Views 。 我想要的效果是左带动画随着Y轴向左的变换而向左。 而右带则沿着Y轴向右的变换。

但上述代码导致左向和右向图像视图在同一方向动画( 仅发生于左方向 ) 。 我猜我对锚点的理解是错误的。 旋转变换中的 - 180 度和+180 度都会导致左向动画。

我在这里做错什么了?

最佳回答

基本上在动画块运行前设置锚点解决问题。 左- gt; (0.0f, 0. 5f) 和右- gt; (1.0f, 0. 5f) 的锁定点。

问题回答

暂无回答




相关问题
Code sign Error

I have created a new iPhone application.I have two mach machines. I have created the certificate for running application in iPhone in one mac. Can I use the other mac for running the application in ...

ABPersonViewController Usage for displaying contact

Created a View based Project and added a contact to the AddressBook using ABAddressBookRef,ABRecordRef now i wanted to display the added contact ABPersonViewController is the method but how to use in ...

将音频Clips从Peter改为服务器

我不禁要问,那里是否有任何实例表明从Peit向服务器发送音响。 I m不关心电话或SIP风格的解决办法,只是一个简单的袖珍流程......

• 如何将搜查线重新定位?

我正试图把图像放在搜索条左边。 但是,问题始于这里,搜索条线不能重新布署。

热门标签