导航栏显示在情节提要中但不显示在模拟器中
Navigation bar is showing in storyboard but not simulator
以下是我的故事板,
并且 ViewController(CaseInfo 或 VC2)正在显示导航栏
http://i.imgur.com/nQqj1IQ.png
但在我的模拟器中,导航栏没有显示!
在 VC1(案例列表)中:
我让 VC1 成为导航控制器的 rootView
我 link VC1 到 VC2 选择 "push" 选项
然后我点击VC1的table项时使用代码:
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
CaseList *tagEditor = [self.storyboard instantiateViewControllerWithIdentifier:@"CaseInfo"];
[self presentViewController:tagEditor animated:YES completion:nil];
}
但是 VC2 中的导航栏没有显示
请帮助我...
谢谢!!
-
顺便说一句
我也是用VC2(CaseInfo)中的代码
- (void)viewWillDisappear:(BOOL)animated
{
[super viewWillAppear:animated];
[self.navigationController setNavigationBarHidden:NO animated:animated];
}
在您的代码中,因为您已将 VC2 和 VC1 与 segue 链接起来
你只需要开火
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
[self performSegueWithIdentifier:@"segueid" sender:nil];
}
然后在prepareForSegue
中传递一些数据。
或
您可以删除 VC2 和 VC1 之间的转接
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
CaseList *tagEditor = [self.storyboard instantiateViewControllerWithIdentifier:@"CaseInfo"];
[self.navigationController pushViewController:tagEditor animated:true];
}
以下是我的故事板,
并且 ViewController(CaseInfo 或 VC2)正在显示导航栏
http://i.imgur.com/nQqj1IQ.png
但在我的模拟器中,导航栏没有显示!
在 VC1(案例列表)中: 我让 VC1 成为导航控制器的 rootView
我 link VC1 到 VC2 选择 "push" 选项
然后我点击VC1的table项时使用代码:
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
CaseList *tagEditor = [self.storyboard instantiateViewControllerWithIdentifier:@"CaseInfo"];
[self presentViewController:tagEditor animated:YES completion:nil];
}
但是 VC2 中的导航栏没有显示
请帮助我...
谢谢!!
-
顺便说一句
我也是用VC2(CaseInfo)中的代码
- (void)viewWillDisappear:(BOOL)animated
{
[super viewWillAppear:animated];
[self.navigationController setNavigationBarHidden:NO animated:animated];
}
在您的代码中,因为您已将 VC2 和 VC1 与 segue 链接起来
你只需要开火
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
[self performSegueWithIdentifier:@"segueid" sender:nil];
}
然后在prepareForSegue
中传递一些数据。
或
您可以删除 VC2 和 VC1 之间的转接
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
CaseList *tagEditor = [self.storyboard instantiateViewControllerWithIdentifier:@"CaseInfo"];
[self.navigationController pushViewController:tagEditor animated:true];
}