How to create a controllable flip effect (flip as far (and fast) as you drag) of an UIView

Posted by allisone on Stack Overflow See other posts from Stack Overflow or by allisone
Published on 2010-04-17T17:20:44Z Indexed on 2010/04/17 17:23 UTC
Read the original article Hit count: 304

Filed under:
|
|
|

I have a card (a flashcard you could say)

What I can do:

On fingersweeping over the flashcard the card gets turned. It's happening by detecting touchesBegan and touchesMoved and then I do stuff like

[UIView beginAnimations:@"View Flip" context:nil]; 
[UIView setAnimationDuration:0.5]; 
[UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];
if (left) {
    [UIView setAnimationTransition: UIViewAnimationTransitionFlipFromLeft forView:self.flashCardView cache:YES];
}else{
    [UIView setAnimationTransition: UIViewAnimationTransitionFlipFromRight forView:self.flashCardView cache:YES];
}

What I can't do (but want to): I want to somehow drag the flip. Imagine this, you have a flashcard and you think you know the answer, you start flipping the card around because you want to see if you are correct, but then... no stop... you hesitate, turn back the card to the way it was, rethink, get the real answer and then finally flip to see that you were right to hesitate.

Now I only have: once you start flipping, you can't stop it.

© Stack Overflow or respective owner

Related posts about flip

Related posts about drag