分享最热门的ios资讯
对UITabBarController上TabBar按钮动画详细介绍-->>保证你有意外收获,如有问题欢迎指点。。
废话就不多说了直接上效果图,这是我公司项目中加的动画,自己可以适当的加以修改称自己想要的
- (void)tabBar:(UITabBar *)tabBar didSelectItem:(UITabBarItem *)item { NSInteger index = [self.tabBar.items indexOfObject:item]; if (self.indexFlag != index) { [self animationWithIndex:index]; } } // 动画 - (void)animationWithIndex:(NSInteger) index { NSMutableArray * tabbarbuttonArray = [NSMutableArray array]; for (UIView *tabBarButton in self.tabBar.subviews) { if ([tabBarButton isKindOfClass:NSClassFromString(@"UITabBarButton")]) { [tabbarbuttonArray addObject:tabBarButton]; } } CABasicAnimation*pulse = [CABasicAnimation animationWithKeyPath:@"transform.scale"]; pulse.timingFunction= [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]; pulse.duration = 0.08; pulse.repeatCount= 1; pulse.autoreverses= YES; pulse.fromValue= [NSNumber numberWithFloat:0.7]; pulse.toValue= [NSNumber numberWithFloat:1.3]; [[tabbarbuttonArray[index] layer] addAnimation:pulse forKey:nil]; self.indexFlag = index; }
本文由 姬長信 创作,文章地址:https://blog.isoyu.com/archives/1220.html
采用知识共享署名4.0 国际许可协议进行许可。除注明转载/出处外,均为本站原创或翻译,转载前请务必署名。最后编辑时间为:9 月 22, 2016 at 08:00 下午