Bharat Jagtap
Bharat Jagtap

Reputation: 1692

iPhone - How to add the page curl effect to the custom views?

I have seen a few libraries ( e.g https://github.com/brow/leaves ) on how to implement page curl effect on iOS .

But these are limited to a pdf , image or coregraphics drawing . What I want to implement is a page shoule be replaced by a custom view ( like a view containing a couple of buttons , an imageview , a UITableView etc ) .
Now my question is how do we have page curl effects for a set of different custom views ( from different view controllers ) ?

Upvotes: 0

Views: 2715

Answers (3)

Kai Huppmann
Kai Huppmann

Reputation: 10775

Not sure what you want to achieve? Is it kind of modal dialog with controls behind a curled-up corner like in maps app or a full book style page curl like in iBooks?

For the first look at Steve Job's answer (never thought I'd say this), the latter can be done with UIPageViewController (look here to start with UIPageViewController).

Upvotes: 0

Lakitu
Lakitu

Reputation: 510

Take a look at the transitionFromView and transitionWithView methods in UIView:

[UIView transitionWithView:containerView
                  duration:0.2
                   options:UIViewAnimationOptionTransitionFlipFromLeft
                animations:^{
                    [fromView removeFromSuperview]; 
                    [containerView addSubview:toView]; 
                }
                completion:NULL
 ];

The options parameter can be set to UIViewAnimationOptionTransitionCurlUp / UIViewAnimationOptionTransitionCurlDown.

Upvotes: 1

Ankit Srivastava
Ankit Srivastava

Reputation: 12405

SampleViewController *sampleView = [[[SampleViewController alloc] init] autorelease];
[sampleView setModalTransitionStyle:UIModalTransitionStylePartialCurl]; 
[self presentModalViewController:sampleView animated:YES];

Upvotes: 2

Related Questions