如何使UINavigationController的导航栏显示在底部?

有什么办法使UINavigationController的默认导航栏显示在底部而不是顶部? 我知道有一个UIToolbar可以显示在底部,但那个是特定于每个视图,不带有“后退”button。

如果您使用NIB创build视图,那么它非常简单 – 在属性 – >底部栏中select导航栏。 如果没有,那么你应该直接访问导航栏并更改其坐标。 在你的视图控制器中:

 CGRect oldRect = self.navigationController.navigationBar.frame; self.navigationController.navigationBar.frame = CGRectMake(x, y, oldRect.width, oldRect.height); 

其中x和y是放置您的导航栏的坐标。

尝试这个 :

 bottomNav = [[UINavigationBar alloc] initWithFrame:CGRectMake(0.0, self.view.frame.size.height - 20, self.view.frame.size.width, 44.0)]; bottomNav.barStyle = UIBarStyleBlackOpaque; [self.parentViewController.view addSubview:bottomNav]; 

我想你可以,但我不认为它会通过苹果的批准

 @implementation UINavigationBar (CustomBar) - (void)drawRect:(CGRect)rect { self.frame = CGRectMake(0, 436, 320, 44); } 

这里是迅捷版本:

 var bottomNav = UINavigationBar(x: 0, y: view.frame.size.height - 20, w: view.frame.size.width, h: 44) bottomNav.barStyle = UIBarStyle.Black parentViewController?.view.addSubview(bottomNav)