iOS使用push隐藏子页面底部bottom TabBar

1、使用pushViewController

如A->B;A是列表页,带有tabbar;B是内容页,不需要tabbar;

在A的事件中打开B,如下代码

-(void)showVideo:(EJAlbumModel *)model bySId:(NSString *)sid{

NSLog(@"%@",@"执行委托");

EJClassVideoViewController *videoController=[[EJClassVideoViewController alloc] init];

videoController.model=model;

videoController.semesterClassId=sid;

self.navigationItem.backBarButtonItem=[[UIBarButtonItem alloc] initWithTitle:@"返回" style:UIBarButtonItemStyleBordered target:nil action:nil];// 修改下级页面的返回按钮,此处我是很想写到videoController中,但是backBarButtonItem的机制决定必须写在A中;

[self.navigationController pushViewController:videoController animated:YES];

}

在B的加载View视图事件initWithNibName中,加入 self.hidesBottomBarWhenPushed=YES;即可实现打开B隐藏tabbar,返回A重新现实tabbar;很简单吧

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil

{

self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];

if (self) {

self.hidesBottomBarWhenPushed=YES;

}

return self;

}

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容