【问题标题】:Error Pushing a navigation controller is not supported [duplicate]不支持推送导航控制器时出错[重复]
【发布时间】:2014-12-11 01:07:23
【问题描述】:

我有一个 UISearchDisplaycontroller,我必须将信息推送到文本字段并需要将其链接到导航视图控制器。

这是错误 -

   2014-12-10 20:05:08.775 Contents Concepts Mobile[2785:333301] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Pushing a navigation controller is not supported'
*** First throw call stack:
(0x2311dc1f 0x30b96c8b 0x26663207 0x268d0229 0x26662b43 0x266f2f67 0x267a4c0f 0x26656c4d 0x265d2aab 0x230e43b5 0x230e1a73 0x230e1e7b 0x23030211 0x23030023 0x2a3c00a9 0x2663c1d1 0xf0225 0x31116aaf)
libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb) 

这是我的代码 -

- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
if ([segue.identifier isEqualToString:@"showRecipeDetail"]) {
    NSIndexPath *indexPath = nil;
    Recipe *recipe = nil;

    if (self.searchDisplayController.active) {
        indexPath = [self.searchDisplayController.searchResultsTableView indexPathForSelectedRow];
        recipe = [searchResults objectAtIndex:indexPath.row];
    } else {
        indexPath = [self.tableView indexPathForSelectedRow];
        recipe = [recipes objectAtIndex:indexPath.row];
    }

    RecipeDetailViewController *destViewController = segue.destinationViewController;
    destViewController.recipe = recipe;



}
}

【问题讨论】:

  • 您是否尝试将导航控制器推送到另一个导航控制器上?
  • 不,我正在尝试将表格视图控制器推送到导航视图控制器
  • 所以你正在推动一个导航视图控制器? “不支持推送导航控制器”
  • 是的,正确。我正在尝试推送导航控制器,但我不知道该怎么做。
  • 你不能。就像错误所说的那样,“不支持推送导航控制器。”

标签: ios xcode push


【解决方案1】:

您也可以发布您的故事板设置吗?看来您在两个不同的视图之间存在链接问题。导致错误消息说您正在尝试推送导航控制器而不是视图控制器。

【讨论】:

  • 我在这里发布了我的故事板的图像。 s1302.photobucket.com/user/mattsuff1/media/…
  • 我使用的表格视图控制器在角落的右边。他们是 3 个控制器。
  • 您不能将导航控制器推送到另一个导航控制器。您只能将视图控制器推送到导航控制器。
  • 目前我正在尝试将一个表视图控制器推送到另一个表视图控制器,但这也不起作用
  • 它们是图片右上角的两个table view controller
猜你喜欢
  • 2013-07-19
  • 2013-03-09
  • 2023-03-27
  • 2012-06-04
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2014-01-11
  • 1970-01-01
相关资源
最近更新 更多