【发布时间】:2012-01-05 15:36:30
【问题描述】:
我正在通过 Xcode 4.2 中的情节提要制作带有导航控制器的应用程序。
我想在加载每个视图并单击屏幕顶部的按钮时隐藏所有导航栏,导航栏应该显示几秒钟(我为此使用了 NStimer)然后隐藏再次。
到目前为止,我已经做到了,但问题是当我推送另一个视图然后返回上一个视图时,可以单击按钮但导航栏不再出现。
这是我的代码:
-(void)viewDidLoad
{
[self.navigationController setNavigationBarHidden:YES animated:YES];
}
-(IBAction)top {
[self.navigationController setNavigationBarHidden:NO animated:YES];
hideNavTimer = [NSTimer scheduledTimerWithTimeInterval:3
target:self selector:@selector (HideNav) userInfo:nil repeats:NO];
}
-(void)HideNav {
[self.navigationController setNavigationBarHidden:YES animated:YES];
[hideNavTimer invalidate];
hideNavTimer=nil;
}
我在推送的每个视图中都使用此代码。
我做错了什么?
【问题讨论】:
-
我认为问题出在 segue 模态转换中。谁能帮帮我?
标签: iphone ios xcode uinavigationbar xcode4.2