在其X轴(水平轴)上旋转UIView

Mob*_*its 7 iphone core-animation uiview uiviewanimation ios

我想在水平轴上旋转UIView 360度,然后刷新视图中的内容.我一直在寻找解决方案.在那里找到了一对夫妇.这就是我的结果.

    [UIView animateWithDuration:1 delay:0 options:UIViewAnimationOptionTransitionNone animations:^{
        self.tableView.layer.transform = CATransform3DMakeRotation(M_PI,1.0,0.0,0.0);
    } completion:^(BOOL finished){
        NSLog(@"Finished first pi");
        [UIView animateWithDuration:1 delay:0 options:UIViewAnimationOptionTransitionNone animations:^{
            self.tableView.layer.transform = CATransform3DMakeRotation(M_PI,1.0,0.0,0.0);
        }  completion:^(BOOL finished) {
            NSLog(@"Finished second pi");

        }];           

    }];
Run Code Online (Sandbox Code Playgroud)

这会翻转视图,但只能翻转180度.我希望它再翻一次,以便我能正常看到视图..

我的NSLog都会一个接一个地显示出来.我相信我在这里遗漏了一些东西.任何帮助都会有所帮助..

谢谢

jam*_*guy 9

在完成块中尝试将新变换与当前变换连接起来.

self.tableView.layer.transform = CATransform3DConcat(self.tableView.layer.transform, CATransform3DMakeRotation(M_PI,1.0,0.0,0.0));
Run Code Online (Sandbox Code Playgroud)