美文网首页
iOS 给tabbar添加动画

iOS 给tabbar添加动画

作者: 夏天爱西瓜汁 | 来源:发表于2018-01-17 17:58 被阅读25次

点击tabbaritem的时候,增加一个动画效果:

颤抖吧o(*////▽////*)q

- (BOOL)tabBarController:(UITabBarController *)tabBarController shouldSelectViewController:(UIViewController *)viewController {
    //[UIView beginAnimations:nil context:nil];
    //[UIView setAnimationDuration:1];
    //[UIView setAnimationBeginsFromCurrentState:NO];
    //[UIView setAnimationCurve:UIViewAnimationTransitionFlipFromLeft];
    //[UIView setAnimationTransition:kCATransitionMoveIn forView:tabBarController.view cache:YES];
    //[UIView setAnimationTransition:UIViewAnimationTransitionFlipFromLeft forView:viewController.view cache:NO];
    //[viewController.view removeFromSuperview];
    //[UIView commitAnimations];
    CATransition *animation =[CATransition animation];
    [animation setDuration:0.75f];
    [animation setType:@"rippleEffect"];
   
    [animation setSubtype:kCATransitionFromRight];
   
    [animation setTimingFunction:[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseOut]];
    [tabBarController.view.layer addAnimation:animation forKey:@"switchView"];
   
    return YES;
}

相关文章

网友评论

      本文标题:iOS 给tabbar添加动画

      本文链接:https://www.haomeiwen.com/subject/gxbuoxtx.html