gpt4 book ai didi

ios - 启动 push segue 会导致 `Pushing a navigation controller is not supported `

转载 作者:行者123 更新时间:2023-12-01 18:09:20 25 4
gpt4 key购买 nike

在我的 UITableView ,当用户点击一个单元格时,我会像这样启动一个 segue:

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
[self performSegueWithIdentifier:@"MCExpandedSegue" sender:self];
}

- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
if ([segue.identifier isEqualToString:@"MCExpandedSegue"]){
// Opens item in browser
MCExpandedViewController *controller = (MCExpandedViewController *) segue.destinationViewController;
}
}
为了让目标 View Controller ( MCExpandedViewController ) 具有导航栏和后退按钮,我将其嵌入到导航 Controller 中,如下所示:
enter image description here
但是,在点击表格中的单元格以进行此转接时,我收到以下错误: *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Pushing a navigation controller is not supported' .这是因为它试图继续使用 MCExpandedViewController 但因为它包含在导航 Controller 中而被绊倒了吗?我怎样才能正确地做到这一点?

最佳答案

  • 删除 the navigation controller并继续MCExpandedViewController直接地。
  • 将此添加到 viewWillAppear:在 MCExpandedViewController.m
    [self.navigationController setNavigationBarHidden:NO animated:YES];
  • 关于ios - 启动 push segue 会导致 `Pushing a navigation controller is not supported `,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34891209/

    25 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com