我正在尝试将导航栏定位在屏幕顶部下方.
I'm trying to position the navigation bar below the top of the screen.
我在 viewWillAppear
中尝试了以下方法:
I've tried the following in viewWillAppear
:
self.navigationController.view.frame = CGRectMake(0.0, 54.0, 320.0, 426.0);
self.navigationController.navigationBar.frame = CGRectMake(0.0, 0.0, 320.0, 44.0);
问题是它似乎只在第一次显示视图时才起作用.如果您转到另一个选项卡并返回,导航栏位于屏幕顶部.当 iPhone 旋转时也会发生这种情况.
The problem is it only seems to work the very first time the view is displayed. If you go to another tab, and back, the navigation bar is at the top of the screen. This also happens when the iPhone is rotated.
我应该尝试调整导航控制器框架,还是应该尝试将导航控制器添加到屏幕顶部下方的另一个视图?
Should I be trying to adjust the navigation controller frame, or should I instead try to add the navigation controller to another view that is below the top of the screen?
虽然晚了,但还是希望能帮到别人.我在 viewDidAppear:animated 中使用了 Stephens 代码,导航栏在返回选项卡时保持不变.这使我可以在导航栏上方使用徽标.我在 viewController 中使用了它.
Although late, I hope this can still help someone else out. I used Stephens code inside viewDidAppear:animated and the navigation bar stays put upon traveling back to the tab. This allowed me to use a logo above the navigation bar. I used this inside my viewController.
- (void)viewDidAppear:(BOOL)animated {
[super viewDidAppear:animated];
self.navigationController.view.frame = CGRectMake(0.0, 100.0, 320.0, 426.0);
self.navigationController.navigationBar.frame = CGRectMake(0.0, 0.0, 320.0, 44.0);
[self loadData];
}
这篇关于iPhone:向下移动 UINavigationBar?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!