0

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.

Sanoj Kashyap
  • 5,020
  • 4
  • 49
  • 75
Sandeep Dhama
  • 614
  • 1
  • 6
  • 20
  • see this http://www.iostute.com/2015/04/how-to-implement-partial-and-full-page.html – Anbu.Karthik Aug 30 '16 at 08:55
  • Thanks Anbu. I have looked into it . but this is happening on click of a button with predefined animation duration and time. I want this functionality as per the on user finger movement as implemented in iBooks app. – Sandeep Dhama Aug 30 '16 at 09:09
  • customize your self add the code in gesture thats all – Anbu.Karthik Aug 30 '16 at 09:11

2 Answers2

2

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..

Andolasoft Inc
  • 1,296
  • 1
  • 7
  • 16
0

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?

Sanoj Kashyap
  • 5,020
  • 4
  • 49
  • 75
  • Sanoj Kashyap, your link is not working, though I think your solution could be useful, I'd be happy to see it. Would be great if you could show it somewhere else. – nickeyzzz Aug 29 '22 at 08:15
  • @nickeyzzz This might help https://stackoverflow.com/questions/477078/turn-a-page-like-a-book-with-uiview – Sanoj Kashyap Aug 29 '22 at 08:57