标签:
简单实现Tabbar的隐藏显示动画
Hide Tabbar Controller with Animation
- (void)setTabBarVisible:(BOOL)visible animated:(BOOL)animated { // bail if the current state matches the desired state if ([self tabBarIsVisible] == visible) return; // get a frame calculation ready CGRect frame = self.tabBarController.tabBar.frame; CGFloat height = frame.size.height; CGFloat offsetY = (visible)? -height : height; // zero duration means no animation CGFloat duration = (animated)? 0.3 : 0.0; [UIView animateWithDuration:duration animations:^{ self.tabBarController.tabBar.frame = CGRectOffset(frame, 0, offsetY); }]; }
判断tabBar当前状态
// know the current state - (BOOL)tabBarIsVisible { return self.tabBarController.tabBar.frame.origin.y < CGRectGetMaxY(self.view.frame); }
//调用
- (void)buttonClick{ [self setTabBarVisible:![self tabBarIsVisible] animated:YES]; }
标签:
原文地址:http://www.cnblogs.com/sixindev/p/4522889.html