首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 移动开发 > Iphone >

Iphone掩藏和显示TabBar的方法

2013-07-08 
Iphone隐藏和显示TabBar的方法- (void)hideTabBar {if (self.tabBarController.tabBar.hidden YES) {re

Iphone隐藏和显示TabBar的方法
- (void)hideTabBar { if (self.tabBarController.tabBar.hidden == YES) { return; } UIView *contentView; 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]; } contentView.frame = CGRectMake(contentView.bounds.origin.x, contentView.bounds.origin.y, contentView.bounds.size.width, contentView.bounds.size.height + self.tabBarController.tabBar.frame.size.height); self.tabBarController.tabBar.hidden = YES; }- (void)showTabBar{ if (self.tabBarController.tabBar.hidden == NO) { return; } UIView *contentView; 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]; } contentView.frame = CGRectMake(contentView.bounds.origin.x, contentView.bounds.origin.y, contentView.bounds.size.width, contentView.bounds.size.height - self.tabBarController.tabBar.frame.size.height); self.tabBarController.tabBar.hidden = NO; }

?

热点排行