Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a full pagecurl? Updated

Ok, so I really like the pagecurl effect, only one problem, when sending feedback email from within the app, the partialPageCurl covers the cancel button and most of the send button for the mail. The buttons still work, but the users won't see them. Is there a way to get the partialPageCurl to a fullPageCurl where it's almost completely off screen? Thanks in advance! Here is currently how I'm pushing the view.

- (IBAction)HelpClicked{

MoreHelp *More = [[MoreHelp alloc] initWithNibName:nil bundle:nil];

More.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;
[self presentModalViewController:More animated:YES];

[More release]; 
}
like image 907
Jason Avatar asked Jul 08 '11 04:07

Jason


4 Answers

Check out the UICatalog code at apple's developer library. Here is the link: http://developer.apple.com/library/ios/#samplecode/UICatalog/Introduction/Intro.html

When you run it you, select Transitions from the UITableView. See the action of 'Curl Image" button. If thats what you need...

You will find curlAction: method in TransitionViewController class. Basically it has two imageview inside a view. Based on which one is displayed and what was the previous transition (curl up or curl down), it displays the other image in a manner that it looks like you curl a page up and then curl it down. The curl imageview completely disappears. Im sure you can adapt it to your UI.

Its pretty much the same as PeyloW's answer only it uses the old setAnimation: commitAnimation pair.

like image 121
Bushra Shahid Avatar answered Oct 28 '22 22:10

Bushra Shahid


No there is no full page curl variant for UIModalTransitionStyle.

If this is what you need then you must implement it manually yourself. It is more complex that doing a simple modal view controller but doable.

This code snipped only works in default portrait layout, and will need tweaking for your needs. But I hope it gives you an idea of what you need to do:

UIView* view = viewController.view;
view.frame = self.view.window.bounds;
[UIView transitionWithView:self.view.window
                  duration:0.2 
                   options:UIViewAnimationOptionTransitionCurlUp 
                animations:^(void) {
                    [self.view.window addSubview:view];
                } 
                completion:^(BOOL finished) {
                    [viewController.view removeFromSuperview];
                    [viewController presentModalViewController:viewController
                                                      animated:NO];
                }];
like image 23
PeyloW Avatar answered Oct 28 '22 23:10

PeyloW


PeyloW's and xs2bush's excellent suggestions will certainly give you a full page curl. I suspect that you're after a more-than-partial-and-less-than-full page curl though. I don't think there's an API for this, but how about a trick that might just work?

Use either PeyloW's or xs2bush's method, but also launch a timer with a duration slightly less than the UIViewAnimationOptionTransitionCurlUp animation duration.

When the timer expires, freeze the animation and remove it from the UIView that is curling up:

curledView.frame = [[curledView.layer presentationLayer] frame];
[curledView.layer removeAllAnimations];

Hopefully, this will get you the desired effect.

like image 42
Spiros Avatar answered Oct 28 '22 23:10

Spiros


I'd use PeyloW's answer, but there is another way. Add a UIView to the modal view you are going to present (in viewDidLoad), and position it in the top left hand corner, and give it a backgroundColor of [UIColor clearColor]. That way the view will not be seen on screen, but the page curl transition will be forced to peel off the screen to 'show' the top-left hand corner view.

like image 43
Benjamin Mayo Avatar answered Oct 28 '22 22:10

Benjamin Mayo