iPhone: Move UINavigationBar down?(iPhone:向下移动 UINavigationBar?)
问题描述
我正在尝试将导航栏定位在屏幕顶部下方.
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?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:iPhone:向下移动 UINavigationBar?
基础教程推荐
- Android:getLastKnownLocation(LocationManager.NETWORK_PROVIDER 2022-01-01
- 如何从 logcat 中删除旧数据? 2022-01-01
- iPhone - 获取给定地点/时区的当前日期和时间并将其与同一地点的另一个日期/时间进行比较的正确方法 2022-01-01
- AdMob 广告未在模拟器中显示 2022-01-01
- libGDX 从精灵或纹理中获取像素颜色 2022-01-01
- iOS4 创建后台定时器 2022-01-01
- NSString intValue 不能用于检索电话号码 2022-01-01
- Cocos2d iPhone 非矩形精灵触摸检测 2022-01-01
- navigator.geolocation.getCurrentPosition 在 Android 浏览器上 2022-01-01
- 通过重定向链接在 Google Play 中打开应用 2022-01-01
