PushViewController iphone 不工作
我无法让 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您只是没有 UINavController!尝试将主视图嵌入 UINavigationController 中,一切都会开始工作。
You just have no UINavController! Try to embed your main view in UINavigationController and everything will start working.
仔细检查以确保您按下的按钮已连接到界面生成器中的正确方法。还可以尝试在 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.
您将无法在基于视图的项目中推送新的视图控制器。您需要创建一个基于导航的项目或在 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