- (void)pushViewController:(UIViewController *)viewController animated:(BOOL)animated
此功能从右侧加载视图。如何从左侧加载视图?
- (void)pushViewController:(UIViewController *)viewController animated:(BOOL)animated
此功能从右侧加载视图。如何从左侧加载视图?
这里是
CATransition *animation = [CATransition animation];
[[self navigationController] pushViewController:elementController animated:NO];
[animation setDuration:0.45];
[animation setType:kCATransitionPush];
[animation setSubtype:kCATransitionFromLeft];
[animation setTimingFunction:[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionDefault]];
[[elementController.view layer] addAnimation:animation forKey:@"SwitchToView1"];
为此,您必须#import <QuartzCore/QuartzCore.h>
不要认为有现成的方法可以做到这一点。您必须自己使用animateWithDuration:delay:options:animations:completion:
or animateWithDuration:animations:completion:
(或任何其他动画方法)为视图设置动画,并相应地更改视图的帧,以便它从右侧进行动画处理。希望这可以帮助 :)
如果你已经被推送到 viewController 你可以使用这个:
[self.navigationController popViewControllerAnimated:YES]