Try the search, it's linked to some great forums

Tuesday, June 21, 2011

Simple Gestures - Swipe

Xcode has a great series of multiTouch gestures.  This snippet creates the most simple swipe;

Add the protocol delegate to the View Controller's .h header file;

     UIGestureRecognizerDelegate

Add the following code to the viewDidLoad in .m file for each gesture defined;
    UISwipeGestureRecognizer *swipeRecognizer = [[UISwipeGestureRecognizer alloc]
                                         initWithTarget:self action:@selector(handleSwipe:)];
    [self.postCard addGestureRecognizer:swipeRecognizer];
    [swipeRecognizer release];


Create the handleSwipe method like;
- (void)handleSwipe:(UISwipeGestureRecognizer *)recognizer
{   
    [self transformMoveNScale];   
}