I need do Page Curl with swipe gesture in iOS.
I have studied the Leaves project ( https://github.com/brow/leaves ), but it does not support swipe gesture.
Did anyone successfully implement page curl with swipe gesture ?
Thanks.
Use the UISwipeGestureRecognizer and UIViewAnimationTransition
- (void)handleSwipe:(UISwipeGestureRecognizer *)sender {
if(sender.state == UIGestureRecognizerStateEnded) {
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:0.3];
[UIView setAnimationTransition:UIViewAnimationTransitionCurlUp forView:window cache:YES];
[self.view addSubview:[newView view]];
[oldView removeFromSuperview];
[UIView commitAnimations];
}
}
- (void)createGestureRecognizers:(UIView *) target {
UISwipeGestureRecognizer *rightSwipeRecognizer = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(handleSwipe:)];
[rightSwipeRecognizer setDirection:(UISwipeGestureRecognizerDirectionRight)];
[target addGestureRecognizer:rightSwipeRecognizer];
[rightSwipeRecognizer release];
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With