如何使UINavigationController的导航栏显示在底部? [英] How to make the Navigation Bar of an UINavigationController display at the bottom?

查看:69
本文介绍了如何使UINavigationController的导航栏显示在底部?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法让 UINavigationController 的默认导航栏显示在底部而不是顶部?
我知道有一个 UIToolbar 可以显示在底部,但是那个特定于每个视图而没有后退按钮。

Is there any way to make the default navigation bar of an UINavigationController display at the bottom instead of the top? I know that there is an UIToolbar that can be displayed at the bottom, but that one is specific to each view and does not carry the "back" button.

推荐答案

如果使用NIB创建视图,则相当简单 - 在属性 - >底栏中选择导航栏。如果没有,那么您应该直接访问导航栏并更改其坐标。在您的视图控制器中:

If you create your view using a NIB, then it is rather simple - select navigation bar in attributes->bottom bar. If not then you should access navigation bar directly and change its coordinates. In your view controller:

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

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

where x and y are coordinates to place your navigation bar.

这篇关于如何使UINavigationController的导航栏显示在底部?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆