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

查看:23
本文介绍了如何使 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天全站免登陆