gpt4 book ai didi

ios - 如何在 View Controller 上获取导航栏?

转载 作者:行者123 更新时间:2023-11-28 18:57:10 24 4
gpt4 key购买 nike

我有三个 View Controller A、B、C。我有连接到A View Controller 的导航 Controller 。在A 我有一些按钮,我已将按钮 segue 附加到 B View Controller 。单击按钮我转到 B View Controller 。在 B View Controller 上单击 TableView 项时我有 UITableView 我正在启动 C View Controller 。下面是该代码

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
if(indexPath.row==0)
{
NSLog(@"first cell");
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"Main" bundle: nil];
UIViewController * vc = [storyboard instantiateViewControllerWithIdentifier:@"BusinessCard"];
[self presentViewController:vc animated:YES completion:nil];

}
else if(indexPath.row==1)
{
NSLog(@"second cell");


}
else if(indexPath.row==2)
{
NSLog(@"third cell");

}

}

但是在 C View Controller 上,导航栏没有出现。我认为 C View Controller 没有链接到导航 Controller 。

最佳答案

您使用navigationController push 方法在C viewController 中显示导航栏

试试这段代码:

UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"Main" bundle: nil];
UIViewController * vc = [storyboard instantiateViewControllerWithIdentifier:@"BusinessCard"];
[self.navigationController pushViewController:vc animated:YES];

关于ios - 如何在 View Controller 上获取导航栏?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31088524/

24 4 0
文章推荐: iOS Parse (Reduce API Requests) 每周在同一天执行一次函数
文章推荐: 当屏幕尺寸改变时保持
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com