I have a working transition using UIViewAnimationTransitionCurlUp
however, I would like the animation to stop halfway through, much like the Maps application...Any thoughts on how to achieve this?

- 1,455
- 2
- 24
- 43
4 Answers
In iOS 3.2 and later, you can give your UIViewController
a UIModalTransitionStyle
of UIModalTransitionStylePartialCurl
. From the UIViewController
reference, we see
typedef enum {
UIModalTransitionStyleCoverVertical = 0,
UIModalTransitionStyleFlipHorizontal,
UIModalTransitionStyleCrossDissolve,
UIModalTransitionStylePartialCurl,
} UIModalTransitionStyle;
So an example use case would be:
UIViewController *viewController;
// …create or retrieve your view controller…
// Note: The modalPresentationStyle must be UIModalPresentationFullScreen,
// and the presenter must also be a full-screen view
viewController.modalPresentationStyle = UIModalPresentationFullScreen;
viewController.modalTransitionStyle = UIModalTransitionStylePartialCurl;

- 2,619
- 1
- 18
- 20
-
1If you'd like to do this, but preserve a bottom toolbar (e.g., not a full-screen curl), see my solution [here](http://stackoverflow.com/a/11406056/1148702) – Tim Arnold Jul 10 '12 at 14:53
I found a solution to add an UIView to UIViewController using Animation block.
m_Container is an UIView who contain my view animation (self). self is an UIView.
CAUTION : You need to have import QuartzCore
To present view with page curl animation you can use :
-(void)PresentView
{
[UIView animateWithDuration:1.0
animations:^{
CATransition *animation = [CATransition animation];
[animation setDelegate:self];
[animation setDuration:0.7];
[animation setTimingFunction:UIViewAnimationCurveEaseInOut];
animation.type = @"pageCurl";
animation.fillMode = kCAFillModeForwards;
animation.endProgress = 0.65;
[animation setRemovedOnCompletion:NO];
[m_container.layer addAnimation:animation forKey:@"pageCurlAnimation"];
[m_container addSubview:self];
;}
];
}
And when you want hide this view you can use :
-(void)HideHelpView
{
[UIView animateWithDuration:1.0
animations:^{
CATransition *animation = [CATransition animation];
[animation setDelegate:self];
[animation setDuration:0.7];
[animation setTimingFunction:UIViewAnimationCurveEaseInOut];
animation.type = @"pageUnCurl";
animation.fillMode = kCAFillModeForwards;
animation.startProgress = 0.35;
[animation setRemovedOnCompletion:NO];
[m_container.layer addAnimation:animation forKey:@"pageUnCurlAnimation"];
[self removeFromSuperview];
;}
];
}
-
Is this private API? It seems to work perfectly but I don't see it in the docs. – SG1 Feb 12 '12 at 18:41
-
This is not a private API, I just use UIView methods to animate a view (m_container for me). You just need to copy methods content in your own methods and change m_container by your view… – TheRonin Feb 13 '12 at 09:20
The Maps partial curl is a private API. You can find details of how to use it in Erica Sadun's book The iPhone Developer's Cookbook, but you will get rejected from the App Store for using it.

- 14,816
- 3
- 48
- 60
Not sure if this will work, but the parameter to +setAnimationRepeatCount:
can be a fraction.

- 25,648
- 10
- 58
- 70