繁体   English   中英

UIView动画

[英]UIView Animation

我需要水平翻转视图。

当我这样做时,我尝试与导航控制器一起翻转,背景屏幕变黑

如何避免这种情况?

我尝试了这段代码。

HomeViewController *homeVC = [[HomeViewController alloc] init];
UINavigationController *nav = [[UINavigationController alloc] initWithRootViewController:homeVC];
nav.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;
nav.modalPresentationStyle = UIModalPresentationFormSheet;
[[self navigationController] presentViewController:nav animated:YES completion:^{
    [Constants showHomeScreenOnViewController:self];
}];

请尝试以下代码:-

UIViewController *controller = [[[MyViewController alloc] init] autorelease];
UIViewAnimationTransition trans = UIViewAnimationTransitionCurlUp;
[UIView beginAnimations: nil context: nil];
[UIView setAnimationTransition: trans forView: [self window] cache: YES];
[navController presentModalViewController: controller animated: NO];
[UIView commitAnimations];

您可以通过以下代码更改演示样式来避免黑屏,

用这个,

 nav.modalPresentationStyle = UIModalPresentationOverFullScreen;

要么

 nav.modalPresentationStyle = UIModalPresentationOverCurrentContext;

希望这会帮助你。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM