4

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

4

4 回答 4

7

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

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

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

于 2011-05-03T07:23:12.073 回答
3

尝试这个 :

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];  
于 2011-05-03T07:18:32.970 回答
0

我认为你可以,但我认为它不会得到 Apple 的批准

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

}
于 2011-05-03T07:21:06.723 回答
0

这是快速版本:

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)
于 2015-07-15T23:02:19.243 回答