對(duì)UITabBarController上TabBar按鈕動(dòng)畫(huà)詳細(xì)介紹-->>保證你有意外收獲,如有問(wèn)題歡迎指點(diǎn)。。
廢話就不多說(shuō)了直接上效果圖,這是我公司項(xiàng)目中加的動(dòng)畫(huà),自己可以適當(dāng)?shù)募右孕薷姆Q自己想要的
#######效果

1.gif
點(diǎn)擊下面的按鈕時(shí)候是不是有動(dòng)畫(huà) 可能這個(gè)Gif動(dòng)畫(huà)有延遲 效果不明顯 下面上代碼。。
########代碼
- (void)tabBar:(UITabBar *)tabBar didSelectItem:(UITabBarItem *)item {
NSInteger index = [self.tabBar.items indexOfObject:item];
if (self.indexFlag != index) {
[self animationWithIndex:index];
}
}
// 動(dòng)畫(huà)
- (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;
}
未完待續(xù)。。。如果有什么問(wèn)題可以+QQ1107385382詢問(wèn),如給你解決了問(wèn)題-->>請(qǐng)好評(píng)