国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 系統 > iOS > 正文

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

2020-07-26 03:04:10
字體:
來源:轉載
供稿:網友

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

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

// 一句話,寫在UITabBarController.m腳本中,tabBar是自動執行的方法 // 點擊tabbarItem自動調用 -(void)tabBar:(UITabBar *)tabBar didSelectItem:(UITabBarItem *)item { NSInteger index = [self.tabBar.items indexOfObject:item]; [self animationWithIndex:index]; if([item.title isEqualToString:@"發現"]) { // 也可以判斷標題,然后做自己想做的事<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的按鈕添加點擊放大縮小的動畫效果,希望對大家有所幫助,如果大家有任何疑問請給我留言,小編會及時回復大家的。在此也非常感謝大家對武林網網站的支持!

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 安乡县| 赫章县| 聂拉木县| 亚东县| 咸阳市| 揭东县| 安溪县| 东宁县| 天峻县| 广州市| 沙雅县| 鄂托克旗| 榆社县| 绥芬河市| 神木县| 隆昌县| 米脂县| 盐亭县| 永丰县| 定州市| 江西省| 阿图什市| 景洪市| 新沂市| 营山县| 高雄县| 颍上县| 新兴县| 沐川县| 彭阳县| 襄城县| 开封市| 浪卡子县| 陆丰市| 凌海市| 裕民县| 林甸县| 武冈市| 甘孜县| 新津县| 平塘县|