`
ydbc
  • 浏览: 720432 次
  • 性别: Icon_minigender_1
  • 来自: 大连
文章分类
社区版块
存档分类
最新评论

tabBarItem 设置动画 animation

 
阅读更多

tabBarItem 点击的时候 能否设置一个好看的动画 下面的代码可以实现


- (void)tabBarController:(UITabBarController *)theTabBarController didSelectViewController:(UIViewController *)viewController

{

[viewController.tabBarItemsetBadgeValue:@"3"];

NSMutableArray *arrayBt = [NSMutableArrayarray];

for (id tabBt in [theTabBarController.tabBar subviews])

{

NSLog(@"~~~~~~~%@",tabBt);

if ([tabBtisKindOfClass:NSClassFromString(@"UITabBarButton")])

{

[arrayBt addObject:tabBt];

}

}


UIView *view = [arrayBtobjectAtIndex:tabBarController.selectedIndex];

int i=0;

for (id tmp in [view subviews])

{

NSLog(@"--------%@",tmp);

i++;

if ([tmpisKindOfClass: NSClassFromString(@"UITabBarSelectionIndicatorView")])

{

//

break;

}

}

CATransition *transition = [CATransitionanimation];

transition.duration = 1.0f;

transition.timingFunction = [CAMediaTimingFunctionfunctionWithName:kCAMediaTimingFunctionEaseInEaseOut];

transition.type = kCATransitionMoveIn;

transition.subtype = kCATransitionFromBottom;

[[[[view subviews]objectAtIndex:i]layer] addAnimation:transition forKey:nil];

}

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics