简体   繁体   English

Xcode 5中的导航栏问题

[英]Navigation bar issue in Xcode 5

I am using navigation controller in my application. 我在我的应用程序中使用导航控制器。 Mostly all controllers have navigation bar hidden false except in one controller. 除了一个控制器外,大多数控制器的导航栏都隐藏为false。 When I pop from that controller then navigation bar is shown weird and the bottom space of about navigation bar is left. 当我从该控制器弹出时,导航栏显示奇怪,左侧导航栏的底部空间。 Also when I do start editing or do some selection or something else the navigation bar becomes normal and the empty space is removed, but it remains till I don't do anything. 此外,当我开始编辑或做一些选择或其他东西时,导航栏变得正常,空白空间被删除,但它一直保持到我什么都不做。 I am using Xcode 5, and these happens in both iOS 6 and ios 7 not tested in iOS 5. In view Did disappear of that controller I do 我正在使用Xcode 5,这些都发生在iOS 6和ios 7中,未在iOS 5中测试过。在视图中我的控制器消失了

self.navigationController.navigationBar.hidden = FALSE;
[self.navigationController setNavigationBarHidden:NO];

Also in view will appear of the other controller I have written 另外在视图中将出现我写的另一个控制器

self.navigationController.navigationBar.hidden = FALSE;
[self.navigationController setNavigationBarHidden:NO];

In both the view auto layout is false as I need to change frame dynamically on different conditions. 在两个视图中,自动布局都是假的,因为我需要在不同条件下动态更改帧。 Please help. 请帮忙。

Use below code. 使用以下代码。

- (void) viewWillAppear:(BOOL)animated { 
[super viewWillAppear:animated];
[self.navigationController setNavigationBarHidden:YES animated:animated];
}

- (void) viewWillDisappear:(BOOL)animated { 
[super viewWillDisappear:animated];
[self.navigationController setNavigationBarHidden:NO animated:animated];
}

Use willAppear/Disappear instead. 使用willAppear / Disappear代替。

In my case i removed that white space by setting background color of the navigation bar view. 在我的情况下,我通过设置导航栏视图的背景颜色删除了该空白区域。 like 喜欢

[[[self navigationController] view] setBackgroundColor:[UIColor colorWithPatternImage:[UIImage imageNamed:@"background.png"]]];

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM