iBook Image Curl Animation on iOS

1.5k Views Asked by At

I am working on iPhone app where i have 5-6 set of images. I want to change the image using page curl animation like iBook where user can swipe the page as per the finger move with page curl animation. I want to implement same animation on iPhone.. Is there any way to do without using the private libraries or UIPageViewController or if there is any sample available to achieve this?

Apart from google search I am getting some kind of libaries such as:

Leaves

paperstack

XBPagecurl

pagecurling

Did not get much help.

2

There are 2 best solutions below

2
Sanoj Kashyap On BEST ANSWER

Please, do not go for exact solution, above solution will give you some idea and you can work on that and extent it. This way you learn more, the more you play. I have suggesting the blog please, go through it explore it.

Turn a page like a Book with UIView?

0
Andolasoft Inc On

Add swipe gesture in your view like this

UISwipeGestureRecognizer *gesture = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(curlAnimation)];
[gesture setDirection:UISwipeGestureRecognizerDirectionLeft];
[self.view1 addGestureRecognizer:gesture];

Make the curl animation using the following code snippet

- (void)curlAnimation
{
    [UIView animateWithDuration:1.0
                     animations:^{
                         CATransition  * animation = [CATransition animation];
                         [animation setDelegate:self];
                         [animation setDuration:1.2f];
                         animation.startProgress = 0.0;
                         animation.endProgress   = 1;
                         [animation setTimingFunction:UIViewAnimationCurveEaseInOut];
                         [animation setType:@"pageCurl"];
                         [animation setSubtype:@"fromRight"];
                         [animation setRemovedOnCompletion:NO];
                         [animation setFillMode: @"extended"];
                         [animation setRemovedOnCompletion: NO];
                         [[self.view1 layer] addAnimation:animation
                                                            forKey:@"pageFlipAnimation"];
                     }
     ];
}

You can set the "fromLeft" in place of fromRight in this method [animation setSubtype:@"fromRight"]for animating from left to right

enter image description here

Happy coding..