显示pushviewcontrolleranimation看起来像presentModalViewController
是否有可能显示pushViewController
animation看起来像presentModalViewController
但具有pushViewController
后台function?
尝试这个 :
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];
如果你想淡入淡出的animation,这种方法的作品。
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];
对于显示PushViewConttroleranimation作为下面的代码正在工作,
推送
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个问题,它的上/下显示浅黑色的背景,
工作,只要它完成发布新的代码在这里。
你应该考虑做一些事情:
ViewController *myVC = [[ViewController alloc] initWithFrame:OFF_SCREEN]; [navigationController pushViewController:myVC animated:NO];
其中OFF_SCREEN是屏幕下面的一些CGRect,例如(0,481,320,480)。 然后使用animation块来调整视图控制器的视图的frame.origin为(0,0)。 你可能会想在viewDidLoad或viewDidAppear中做animation块。