1、直接通过UITabbarController.selectedindex = 1@R_856_404@面的话,可以用下面的方法实现跳转后动画页面
var selectedViewController = UITabbarController.selectedViewController
var animation = CATransition()
animation.duration = 0.5
animation.type = kCATransitionPush//动画样式,有多种
animation.subtype = kCATransitionFromLeft
animation.timingFunction = CAMediaTimingFunction(name:kCAMediaTimingFunctionEaSEOut)
selectedViewController.view.layer.addAnimation(animation,forKey: "switchView")//添加动画
2、点击tabbar切换页面,可以在UITabBarControllerDelegate的实现方法didSelectViewController中添加动画
func tabBarController(tabBarController: UITabBarController,didSelectViewController viewController: UIViewController) {
var animation = CATransition()
animation.duration = 0.5
animation.type = kCATransitionPush
animation.subtype = kCATransitionFromLeft
animation.timingFunction = CAMediaTimingFunction(name:kCAMediaTimingFunctionEaSEOut)
viewController.view.layer.addAnimation(animation,forKey: "switchView")
}