国产探花免费观看_亚洲丰满少妇自慰呻吟_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的按鈕添加點擊放大縮小的動畫效果,希望對大家有所幫助,如果大家有任何疑問請給我留言,小編會及時回復大家的。在此也非常感謝大家對武林網網站的支持!

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 淮滨县| 泸西县| 枞阳县| 泰州市| 永济市| 彭泽县| 冀州市| 二手房| 马尔康县| 丰宁| 万年县| 广元市| 吴堡县| 定结县| 和田市| 白玉县| 大埔县| 安义县| 乾安县| 安泽县| 屏边| 冷水江市| 登封市| 涞水县| 竹山县| 涿州市| 扎赉特旗| 富川| 福安市| 湘潭县| 屏山县| 丰原市| 舒兰市| 江山市| 井冈山市| 高邑县| 东莞市| 平乡县| 南丰县| 彩票| 桐庐县|