欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

iOS中給自定義tabBar的按鈕添加點(diǎn)擊放大縮小的動畫效果

 更新時間:2016年11月23日 14:20:49   投稿:mrr  
這篇文章主要介紹了iOS中給自定義tabBar的按鈕添加點(diǎn)擊放大縮小的動畫效果的相關(guān)資料,非常不錯,具有參考解決價值,需要的朋友可以參考下

之前想過一些通過第三方的方式實現(xiàn)動畫,感覺有點(diǎn)麻煩,就自己寫了一個

不足之處還望大家多多指出

// 一句話,寫在UITabBarController.m腳本中,tabBar是自動執(zhí)行的方法 
// 點(diǎn)擊tabbarItem自動調(diào)用 
-(void)tabBar:(UITabBar *)tabBar didSelectItem:(UITabBarItem *)item 
{ 
NSInteger index = [self.tabBar.items indexOfObject:item]; 
[self animationWithIndex:index]; 
if([item.title isEqualToString:@"發(fā)現(xiàn)"]) 
{ 
// 也可以判斷標(biāo)題,然后做自己想做的事<img alt="得意" src="http://static.blog.csdn.net/xheditor/xheditor_emot/default/proud.gif" /> 
} 
} 
- (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]; 
}

以上所述是小編給大家介紹的iOS中給自定義tabBar的按鈕添加點(diǎn)擊放大縮小的動畫效果,希望對大家有所幫助,如果大家有任何疑問請給我留言,小編會及時回復(fù)大家的。在此也非常感謝大家對腳本之家網(wǎng)站的支持!

相關(guān)文章

最新評論