UIPopOverController 与 UINavigationController 与 Xcode 4.2.1
这听起来可能很简单,但不知怎的,我无法摆脱这个困境。我创建了一个空应用程序,通过在 AppDelegate.h 和 AppDelegate.m 文件中创建两个 tabBar 项目来添加它们。现在,对于我的第二个 tabBar 项目,当用户单击第二个 tabBar 项目时,我想显示一个 popOverController。我通过以下链接链接以编程方式创建了该内容。现在我的问题是我想在我的代码中使用导航控制器,我已经创建了我的 popOverController (AppDelegate.m),以便在我的 popOverController.m 中,我想使用 NavController 来推送其他视图。如果有人有一个简单的方法来实现这一目标,将不胜感激。
谢谢
this may sound simple, but somehow I am not able to get out of this. I have created an empty app, added two tabBar items by creating them in AppDelegate.h and AppDelegate.m files. Now for my second tabBar item, when the user clicks the second tabBar item I want to display a popOverController. I have programmatically created that, by following this link Link. Now my problem is I want to use Navigation Controller in my code where I have created my popOverController (AppDelegate.m) so that in my popOverController.m, I want to use the NavController to push other views. If someone has a simple way of achieving this, would be appreciated.
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我对你的问题出在哪里有点困惑。您尝试做的事情是可能的并且应该是直接的。如果您的问题是没有推送下一个视图,因为在 popoverController 中您无权访问 self.navigationController 。如此简单的解决方案,创建一个 UINavigationController 变量并将 navigationController 传递给您的弹出窗口,或者使用通知传递要推回您的 AppDelegate 的视图。
编辑
您可以使用它来监听通知:
然后使用它来发送通知:
选择器将是您的函数名称(我只是输入了一个描述性名称“popOverViewControllerSelected”),并且该对象需要是有关要推送的 viewController 的信息(即 1、2、3 或 @“view1”)。然后你需要:
我所说的另一种方法是在你的 popOverViewController.h 中添加
在你的 popOverViewController.m 中添加:
然后无论你在哪里添加 popOverViewController 只需添加:
现在在你的 PopOverViewController 中你可以调用:
但是我建议执行第一个选项。
I am little confused on where your problem is. What your trying to do is possible and should be straight forward. If your problem is that the Next view is not being pushed its because in popoverController you don't have access to
self.navigationController
. So easy solution, create a UINavigationController variable and pass navigationController to your popover or use notifications to pass what view to push back to your AppDelegate.EDIT
You can use this to listen for notifications:
Then use this to send the notifications:
The selector would be your function name (I just put a descriptive name "popOverViewControllerSelected") and the object would need to be information on what viewController to push (i.e. 1,2,3 or @"view1"). Then you would need:
The other way I was talking about is in you popOverViewController.h add in
In you popOverViewController.m add the:
Then where ever you are adding the popOverViewController just add:
And now in your PopOverViewController you can call:
But I recommend doing the first option.