My first Swipe and Pinch methods yesterday.
This is the pinch from my View from my HW #3:
- (void)pinch:(UIPinchGestureRecognizer *)gesture { if ((gesture.state == UIGestureRecognizerStateChanged) || (gesture.state == UIGestureRecognizerStateEnded)) { self.faceCardScaleFactor *= gesture.scale; gesture.scale = 1; // reset } }
And here is the Swipe from my Controller with a block for animating the card flip (line 6-9):
- (IBAction)swipe:(UISwipeGestureRecognizer *)sender { [UIView transitionWithView:self.playingCardView duration:0.5 options:UIViewAnimationOptionTransitionFlipFromLeft animations:^{ if (!self.playingCardView.faceUp) [self drawRandomPlayingCard]; self.playingCardView.faceUp = !self.playingCardView.faceUp; } completion:NULL]; }
Next UICollectionView.