(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>