Swipe & Pinch

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.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s