Is there a full pagecurl? Updated
Asked Answered
L

4

6

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]; 
}
Lupe answered 8/7, 2011 at 4:32 Comment(2)
[ Here u will get information that how page curl.](oleb.net/blog/2010/06/app-store-safe-page-curl-animations)Caneghem
A page curl is what you see when you change the map type in the Maps app, not what you see in the iBooks app.Calefacient
B
3

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];
                }];
Bixler answered 19/7, 2011 at 15:21 Comment(7)
I believe trying to use your example, I would need to create a IBOutlet UIView, and copy my current xib as a UIView within the same xib I'm launching from correct? So if my IBOutlet is named "aboutView" I would replace viewController.view with aboutView.view correct? Hope that makes sense...Lupe
This doesn't work...` UIView* view = aboutView.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) { [aboutView.view removeFromSuperview]; [aboutView presentModalViewController:viewController animated:NO]; }];Lupe
@jason - Why does it not work? Is it being displayed wrong, or just do nothing? Is the curl missing but the aboutView getting presented after a delay? Have you checked that self.view.window is not nil?Bixler
getting errors like the .view isn't right...I'm still pretty new to programming, so messing around with it trying to figure out what I need to change to make it work for me...Lupe
I haven't been able to get this to work. I added my code above if you could take a look and help me get this working. Thank you!Lupe
Isn't that too much? If first adds view as subview to the window and then presents yet another viewController on top of all that. You end up with one view added for nothing and covered up by view controller. I tried just presenting viewController with no animations in animations block and do nothing in completion block. Works just fine with no overhead.Signe
You can make this work in landscape by adding these lines: viewController.view.transform = self.view.window.rootViewController.view.transform; viewController.view.frame = self.view.window.rootViewController.view.frame;Flange
M
4

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.

Megagamete answered 20/7, 2011 at 7:54 Comment(1)
I have added code to show what im currently doing. I can't seem to get this to work, I need help!Lupe
B
3

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];
                }];
Bixler answered 19/7, 2011 at 15:21 Comment(7)
I believe trying to use your example, I would need to create a IBOutlet UIView, and copy my current xib as a UIView within the same xib I'm launching from correct? So if my IBOutlet is named "aboutView" I would replace viewController.view with aboutView.view correct? Hope that makes sense...Lupe
This doesn't work...` UIView* view = aboutView.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) { [aboutView.view removeFromSuperview]; [aboutView presentModalViewController:viewController animated:NO]; }];Lupe
@jason - Why does it not work? Is it being displayed wrong, or just do nothing? Is the curl missing but the aboutView getting presented after a delay? Have you checked that self.view.window is not nil?Bixler
getting errors like the .view isn't right...I'm still pretty new to programming, so messing around with it trying to figure out what I need to change to make it work for me...Lupe
I haven't been able to get this to work. I added my code above if you could take a look and help me get this working. Thank you!Lupe
Isn't that too much? If first adds view as subview to the window and then presents yet another viewController on top of all that. You end up with one view added for nothing and covered up by view controller. I tried just presenting viewController with no animations in animations block and do nothing in completion block. Works just fine with no overhead.Signe
You can make this work in landscape by adding these lines: viewController.view.transform = self.view.window.rootViewController.view.transform; viewController.view.frame = self.view.window.rootViewController.view.frame;Flange
J
1

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.

Jennefer answered 20/7, 2011 at 11:59 Comment(0)
C
1

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.

Cutlor answered 24/7, 2011 at 9:26 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.