显示pushviewcontroller动画样子presentModalViewController
-
27-09-2019 - |
题
时它可以显示pushViewController
动画样子presentModalViewController
但有pushViewController
的背景功能?
解决方案
尝试这种情况:
UIViewController *yourViewController = [[UIViewController alloc]init];
[UIView beginAnimations: @"Showinfo"context: nil];
[UIView setAnimationCurve: UIViewAnimationCurveEaseInOut];
[UIView setAnimationDuration:0.75];
[self.navigationController pushViewController: yourViewController animated:NO];
[UIView setAnimationTransition:UIViewAnimationTransitionFlipFromRight forView:self.navigationController.view cache:NO];
[UIView commitAnimations];
其他提示
如果您希望将动画渐变,这种方法的作品。
CATransition* transition = [CATransition animation];
transition.duration = 0.3;
transition.type = kCATransitionFade;
transition.subtype = kCATransitionFromTop;
[self.navigationController.view.layer addAnimation:transition forKey:kCATransition];
[self.navigationController pushViewController:gridController animated:NO];
有关显示PushViewConttroler动画如下代码当前正在工作,
有关的推强>
ViewController *VC = [self.storyboard instantiateViewControllerWithIdentifier:@"ViewController"];
CATransition* transition = [CATransition animation];
transition.duration = 0.4f;
transition.type = kCATransitionMoveIn;
transition.subtype = kCATransitionFromTop;
[self.navigationController.view.layer addAnimation:transition
forKey:kCATransition];
[self.navigationController pushViewController:VC animated:NO];
和对的 POP 强>
CATransition* transition = [CATransition animation];
transition.duration = 0.4f;
transition.type = kCATransitionReveal;
transition.subtype = kCATransitionFromBottom;
[self.navigationController.view.layer addAnimation:transition
forKey:kCATransition];
[self.navigationController popViewControllerAnimated:NO];
有1个问题虽然,其显示光黑色背景时其将向上/向下,结果, 对工作,一旦其完成张贴新的代码在这里。
有关所有Xamarin尝试(C#)的等效代码 从上述@hardik THAKKAR答案,有动画期间backgound黑的问题,休息都好。
有关POP
CATransition transition = CATransition.CreateAnimation();
transition.Duration = 0.4;
transition.Type = CAAnimation.TransitionReveal;
transition.Subtype = CAAnimation.TransitionFromTop;
this.NavigationController.View.Layer.AddAnimation(transition, nameof(CATransition));
有关推
CATransition transition = CATransition.CreateAnimation();
transition.Duration = 0.4;
transition.Type = CAAnimation.TransitionReveal;
transition.Subtype = CAAnimation.TransitionFromBottom;
this.NavigationController.View.Layer.AddAnimation(transition, nameof(CATransition));
您应该考虑做这样的事情:
ViewController *myVC = [[ViewController alloc] initWithFrame:OFF_SCREEN];
[navigationController pushViewController:myVC animated:NO];
其中OFF_SCREEN是在屏幕下方一些的CGRect,如(0,481,320,480)。然后,使用一个动画块调整的ViewController的视图的frame.origin为(0,0)。你可能会想这样做在viewDidLoad中或viewDidAppear的动画块。
不隶属于 StackOverflow