使用您在此处显示的代码,您可以设置 imagePickerView 的 modalTransitionStyle 属性。但是,您可能的值是(来自 SDK 文档):
- UIModalTransitionStyleCoverVertical:当呈现视图控制器时,它的视图从屏幕底部向上滑动。解雇时,视图会向下滑动。这是默认的过渡样式。
- UIModalTransitionStyleFlipHorizontal:当呈现视图控制器时,当前视图会启动从右到左的水平 3D 翻转,从而显示新视图,就好像它在前一个视图的背面一样。关闭时,翻转从左到右发生,返回到原始视图。
- UIModalTransitionStyleCrossDissolve:当呈现视图控制器时,当前视图淡出,而新视图同时淡入。在关闭时,使用类似类型的交叉淡入淡出来返回原始视图。
你的另一个选择需要你变得更漂亮。假设 navigationController 是应用程序的根视图控制器,它存储在应用程序委托的一个名为 navigationController 的属性中。您可以实现以下方法:
- (void)curlInViewController:(UIViewController *)viewController {
self.curledViewController = viewController;
[UIView beginAnimations:@"curlInView" context:nil];
[UIView setAnimationTransition:UIViewAnimationTransitionCurlDown forView:self.window cache:YES];
[self.navigationViewController.view removeFromSuperview];
[self.window addSubview:viewController.view];
[UIView commitAnimations];
}
- (void)curlOutViewController {
[UIView beginAnimations:@"curlOutView" context:nil];
[UIView setAnimationDelegate:self];
[UIView setAnimationDidStopSelector:@selector(animationDidStop:finished:context:)
[UIView setAnimationTransition:UIViewAnimationTransitionCurlUp forView:self.window cache:YES];
[self.curledViewController removeFromSuperview];
[self.window addSubview:navigationController.view];
[UIView commitAnimations];
}
- (void)animationDidStop:(NSString *)animationID finished:(NSNumber *)finished context:(void *)context {
if([animationID isEqualToString:@"curlOutView"]) {
self.curlViewController = nil;
}
}