iPhone card like flipping animation

江枫思渺然 提交于 2019-12-09 12:58:14

问题


I'm trying to create a card flipping animation on iOS, and I'm failing miserably.
Basically I have a global View with a Controller. Inside I have a holderView, which contains the card.
I have the front of the card, which is the mainView, and then the back of the card, which is a flipSideView.

I have tried doing something like this:

[UIView animateWithDuration:1.0
                              delay:0
                            options:UIModalTransitionStyleFlipHorizontal
                         animations:^{
        NSLog(@"started");

        [mainView removeFromSuperview];
        [holderView addSubview:flipsideView];


    } completion:^(BOOL finished){

        NSLog(@"completed");
    }];

That doesn't work, does weird things, I have tried a lot of different things but cannot get it to work perfectly. Would anyone have an idea how I can do that ?

Thank you


回答1:


Try this:

[UIView transitionFromView:mainView
  toView:holderView
  duration:1.0f
  options:UIViewAnimationOptionTransitionFlipFromRight
  completion:^(BOOL finished) {}];

That should work. Hope that Helps!



来源:https://stackoverflow.com/questions/9984804/iphone-card-like-flipping-animation

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!