Git Product home page Git Product logo

erhudemo's People

Contributors

erhu1993 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

erhudemo's Issues

Tabbar动画第一次点击没有显示动画效果?

博主,我按照你添加动画的方式给imageView添加了动画效果,但启动App后第一次点击之前没有选中过的item没有动画,再点击就有动画了,你有遇到吗?

`-(void)tabBarController:(UITabBarController *)tabBarController didSelectViewController:(UIViewController *)viewController{
DLog(@"选中 %ld",tabBarController.selectedIndex);
[self addTabBarButtonRotationAnimationWithCurrentViewController:viewController index:tabBarController.selectedIndex];
}

  • (void)addTabBarButtonRotationAnimationWithCurrentViewController:(UIViewController *)currentViewController index:(NSInteger )index{

    UIImageView *tabBarSwappableImageView = [self getTabBarButtonImageViewWithCurrentVc:currentViewController];

    if (tabBarSwappableImageView) {

      CASpringAnimation *springAnimation = [CASpringAnimation animationWithKeyPath:@"bounds"];
      springAnimation.fromValue = [NSValue valueWithCGRect:CGRectMake(tabBarSwappableImageView.centerX, tabBarSwappableImageView.centerY, tabBarSwappableImageView.width*0.85, tabBarSwappableImageView.width*0.85)];
      springAnimation.toValue = [NSValue valueWithCGRect:tabBarSwappableImageView.frame];
      //质量,影响图层运动时的弹簧惯性,质量越大,弹簧拉伸和压缩的幅度越大 Defaults to one
      springAnimation.mass = 3;
      //刚度系数(劲度系数/弹性系数),刚度系数越大,形变产生的力就越大,运动越快 Defaults to 100
      springAnimation.stiffness = 1300;
      //阻尼系数,阻止弹簧伸缩的系数,阻尼系数越大,停止越快 Defaults to 10
      springAnimation.damping = 20;
      //速率为正数时,速度方向与运动方向一致,速率为负数时,速度方向与运动方向相反
      springAnimation.initialVelocity = -10   ;
      //估算时间 返回弹簧动画到停止时的估算时间,根据当前的动画参数估算
      springAnimation.duration = springAnimation.settlingDuration;
      springAnimation.removedOnCompletion = YES;
      
      [[tabBarSwappableImageView layer] addAnimation:springAnimation forKey:nil];
      NSLog(@"添加");
    

    }
    }

  • (UIImageView *)getTabBarButtonImageViewWithCurrentVc:(UIViewController *)currentViewController{

    UIControl *tabBarButton = [currentViewController.tabBarItem valueForKey:@"view"];
    if (tabBarButton) {
    UIImageView *tabBarSwappableImageView = [tabBarButton valueForKey:@"info"];
    if (tabBarSwappableImageView) {
    return tabBarSwappableImageView;
    }
    }
    return nil;
    }`

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.