gpt4 book ai didi

ios - UINavigationController 和 "Pushing a navigation controller is not supported"异常?

转载 作者:行者123 更新时间:2023-11-28 22:52:23 26 4
gpt4 key购买 nike

我试图重做 Appress 的 How to create UINavigationController based application from Beginning iPhone Development 示例。

我收到以下异常:

Exception: Pushing a navigation controller is not supported
Exception: [NSException]:Pushing a navigation controller is not supported
ex.name:'NSInvalidArgumentException'
ex.reason:'Pushing a navigation controller is not supported'

当用户尝试推送已在堆栈中的 View 时,会发生这种情况,这在我的情况下并非如此。

My_3AppDelegate.h

IBOutlet UINavigationController * navController; 
@property (nonatomic, retain) UINavigationController * navController;

My_3AppDelegate.m

[window addSubview: navController.view]; 

MainWindow.xibUINavigationController 添加到连接到 socket 的窗口。

我的代码中唯一的区别是 RootViewController 不是 UITableViewController 的子类。它只是带有 2 个 UIbuttonUIViewController

FirstViewController *fv = [[FirstViewController alloc] initWithNibName:@"FirstViewController" bundle:nil];
fv.navigationItem.title=@"First View Controller";
[self.navigationController pushViewController:fv animated:NO];
[fv release];

这个错误发生在应用程序的初始运行时,这确保了,它不是那样的, View 已经添加到堆栈中,我正在尝试准备好。

它是一个非常简单的教程应用程序,我一直坚持使用它,但我不确定为什么?

有什么想法吗?

最佳答案

我通过将父类(super class)从 UINavigationCotroller 更改为 UIViewController 解决了同样的问题。

关于ios - UINavigationController 和 "Pushing a navigation controller is not supported"异常?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11620633/

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