如何隐藏导航栏+工具栏并在滚动时更改tableView高度

时间:2016-06-19 20:39:59

标签: ios xcode swift

我在导航控制器中嵌入了一个视图控制器,工具栏下面附有工具栏,因此它具有以下样式:enter image description here

正如您在我的故事板中看到的那样,我也有一个带有tableviewcontroller的容器视图:

enter image description here

滚动时,我需要隐藏我能够做的导航栏。问题是,我还必须隐藏导航栏下方的工具栏以及展开表格视图的高度,以便当导航栏和工具栏都消失时,表格视图可以使用额外的空间。

1 个答案:

答案 0 :(得分:0)

I don't have perfect answer but try to use below code in cellForRowAtIndexPath will help you..

you did not mentioned weather your code is in objective C/ Swift. I am providing you Both ::

Obj-C

[[self navigationController] setNavigationBarHidden:YES animated:YES];

Swift

self.navigationController().setNavigationBarHidden(true, animated: true)

For tabBar, If you want to hide tabBar with navigationBar use this thing.. use this

中的页面链接

或者将其用于tabBar hide>

DetailViewController *detailViewController = [[DetailViewController alloc] init];
detailViewController.hidesBottomBarWhenPushed = YES;
[[self navigationController] pushViewController:detailViewController animated:YES];    
[detailViewController release];