UITabBarController 页面切换动画

 
 
 

但是这里界面切换的实现全部由UITabBarController,也就是系统自动帮你来实现了,要在哪里添加动画代码呢?

很简单,写一个类继承自UITabBarController,然后实现下面这个委托方法就行了:

CATransition* animation = [CATransition animation];
        [animation setDuration:0.5f];
        [animation setType:kCATransitionFade];
        [animation setSubtype:kCATransitionFromRight];
        [animation setTimingFunction:[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseOut]];
        [[self.view layer]addAnimation:animation forKey:@"switchView"];

你可能感兴趣的:(UITabBarController 页面切换动画)