PushViewController iphone 不工作

发布于 2024-12-03 17:40:59 字数 429 浏览 2 评论 0原文

我无法让 PushViewController 在 iPhone 上的基于视图的应用程序上工作。在我的“ProjectViewController”上,我有一个带有以下代码的 IBAction:

-(IBAction)switchAugmented
{
    ARViewController *viewController = [[ARViewController alloc] initWithDelegate:self];
    [self.navigationController pushViewController:viewController animated:YES];
    [viewController release];
}

当我运行程序并按 ibaction 时,没有任何反应。除了上面的声明之外,我还需要做其他事情来使视图出现吗?我缺少什么?

i am unable to get the pushViewController to work on a View Based Application on the iPhone. On my 'ProjectViewController' i have a IBAction with the following code :

-(IBAction)switchAugmented
{
    ARViewController *viewController = [[ARViewController alloc] initWithDelegate:self];
    [self.navigationController pushViewController:viewController animated:YES];
    [viewController release];
}

When i run the program and press ibaction nothing happens. Besides that statement above do i need to do anything else to make the view appear? what am i missing?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

何处潇湘 2024-12-10 17:40:59

(...) 基于视图的应用程序 (...)

您只是没有 UINavController!尝试将主视图嵌入 UINavigationController 中,一切都会开始工作。

(...) on a View Based Application (...)

You just have no UINavController! Try to embed your main view in UINavigationController and everything will start working.

情绪少女 2024-12-10 17:40:59

仔细检查以确保您按下的按钮已连接到界面生成器中的正确方法。还可以尝试在 switchAugmented 中添加 NSLog 语句来查看该方法是否被调用。

您还必须检查是否有 UINavigationController 实例,否则您将无法推送新的视图控制器。

Double check to make sure that the button you are pressing is connected to the right method in interface builder. Also try putting an NSLog statement in the switchAugmented to see if the method is getting called.

You also have to check and see if you have a UINavigationController instance, otherwise you won't be able to push a new view controller.

凯凯我们等你回来 2024-12-10 17:40:59

您将无法在基于视图的项目中推送新的视图控制器。您需要创建一个基于导航的项目或在 Main.nib 中添加 UINavigationController 的实例(如果您使用 nib 文件),然后推送视图控制器才能工作

You won't be able to push a new view controller in a View Based Project. You need to create a Navigation Based Project or add an instance of the UINavigationController in your Main.nib (if your using a nib file) only then will the push view controller will work

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文