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

首頁 > 系統 > iOS > 正文

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

2019-10-21 18:50:19
字體:
來源:轉載
供稿:網友

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

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

// 一句話,寫在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的按鈕添加點擊放大縮小的動畫效果,希望對大家有所幫助,如果大家有任何疑問請給我留言,小編會及時回復大家的。在此也非常感謝大家對VEVB武林網網站的支持!


注:相關教程知識閱讀請移步到IOS開發頻道。
發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 徐水县| 新河县| 灯塔市| 个旧市| 建宁县| 和平县| 双峰县| 长宁区| 洪雅县| 农安县| 德昌县| 泾源县| 沭阳县| 曲阜市| 寻甸| 昆山市| 土默特右旗| 裕民县| 天祝| 平邑县| 万山特区| 且末县| 长寿区| 大安市| 蓬安县| 包头市| 文成县| 秭归县| 娄底市| 宜州市| 革吉县| 安新县| 会泽县| 龙口市| 会昌县| 宁城县| 莱州市| 遂溪县| 呈贡县| 凤庆县| 浮梁县|