【发布时间】:2013-11-20 09:36:53
【问题描述】:
我想在滚动集合视图时隐藏我的标签栏,代码是
#pragma mark - UIScrollViewDelegate
- (void)scrollViewWillBeginDecelerating:(UIScrollView *)scrollView
{
[self makeTabBarHidden:YES];
}
- (void)scrollViewWillBeginDragging:(UIScrollView *)scrollView
{
[self makeTabBarHidden:NO];
}
- (void)makeTabBarHidden:(BOOL)hide
{
if ( [self.tabBarController.view.subviews count] < 2 )
{
return;
}
UIView *contentView;
UIView *bradeView = [self.tabBarController.view.subviews objectAtIndex:2];
if ( [[self.tabBarController.view.subviews objectAtIndex:0]
isKindOfClass:[UITabBar class]] )
{
contentView = [self.tabBarController.view.subviews objectAtIndex:1];
}
else
{
contentView = [self.tabBarController.view.subviews objectAtIndex:0];
}
// [UIView beginAnimations:@"TabbarHide" context:nil];
if ( hide )
{
contentView.frame = self.tabBarController.view.bounds;
}
else
{
contentView.frame = CGRectMake(self.tabBarController.view.bounds.origin.x,
self.tabBarController.view.bounds.origin.y,
self.tabBarController.view.bounds.size.width,
self.tabBarController.view.bounds.size.height -
self.tabBarController.tabBar.frame.size.height);
}
self.tabBarController.tabBar.hidden = hide;
bradeView.hidden = hide;
}
但在 iOS7 中,当标签栏被隐藏时,有一个不会关闭的黑条。 iOS7如何隐藏标签栏?
【问题讨论】:
标签: ios objective-c ios7 hidden tabbar