效果1:
UIViewController *vc = self.viewControllers[self.selectedIndex];
CATransition *animation =[CATransition animation];
[animation setDuration:0.75f];
[animation setTimingFunction:[CAMediaTimingFunctionfunctionWithName:kCAMediaTimingFunctionDefault]];
[animation setType:kCATransitionMoveIn];
[animation setSubtype:kCATransitionFromRight];
[vc.view.layer addAnimation:animation forKey:@"reveal"];
效果2:
CATransition *animation =[CATransitionanimation];
[animation setDuration:0.75f];
[animation setTimingFunction:[CAMediaTimingFunctionfunctionWithName:kCAMediaTimingFunctionDefault]];
[animation setType:kCATransitionMoveIn];
[animation setSubtype:kCATransitionFromRight];
[self.view.layer addAnimation:animation forKey:@"reveal"];
运行看效果!
原文地址:http://www.cnblogs.com/yangmx/p/3853026.html