Modal UIViewController 不会推送到下一个 UIViewController
结构的开始如下...
UITabBarController -> UINavigationController(s)
从每个 UINavigationController 中,我都有一个以模态方式呈现 UIViewController 的 UIBarButtonItem。
此 UIViewController 有一个 MKMapView,其引脚位于多个位置。单击时,它们会显示带有公开按钮的注释。
在这个 UIViewController 中,我的目的是在按下注释的公开按钮时推送详细信息页面(UITableViewController)。方法 calloutAccessoryControlTapped: 接收适当的引脚,但转换到下一个控制器失败。
我已经尝试了以下方法的每种组合...
- [self.navigationController ...]
- [self.parentViewController ...]
- [self.parentViewController.navigationController ...]
与方法是...
- presentModalViewController:
- pushViewController:
我已经完成了所有这些操作,UIViewController 是单独的,并且还嵌入在 UINavigationController 中。
所有这些这些属性返回 null...
- self.navigationController
- self.parentViewController
- self.parentViewController.navigationController
这是我第一次在 Xcode 项目中使用 Storyboard。我错过了一个步骤吗?
The start of the structure is as follows...
UITabBarController -> UINavigationController(s)
From each of the UINavigationControllers, I have a UIBarButtonItem that modally presents a UIViewController.
This UIViewController has a MKMapView with pins at multiple locations. When clicked, they display an annotation with a disclosure button.
Within this UIViewController, it is my intention to push a detail page (UITableViewController) when pressing the disclosure button of the annotation. The method calloutAccessoryControlTapped: receives the appropriate pin, but the transition to the next controller fails.
I have tried every combination of the following methods...
- [self.navigationController ...]
- [self.parentViewController ...]
- [self.parentViewController.navigationController ...]
with the method being either...
- presentModalViewController:
- pushViewController:
I have done all of these with the UIViewController being on its own, and also with it embedded inside of a UINavigationController.
All of these properties return null...
- self.navigationController
- self.parentViewController
- self.parentViewController.navigationController
This is the first time I've used storyboard for an Xcode project. Am I missing a step?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
尝试摆脱代码并通过控制从按钮拖动到您希望以模态方式加载的视图控制器来实现故事板中的转换。当弹出“Storyboard Segue”菜单时,选择“modal”。在模态视图控制器中,我喜欢使用代码通过调用从模态返回:
以编程方式滚动到 gravityjack 在提供的链接上。
例如,我有一个在故事板中创建的视图控制器,我可以使用以下两个语句以编程方式调用它:
Try getting rid of the code and implementing the transitions in storyboard by control dragging from the button to the view controller you wish to load modally. When the "Storyboard Segue" menu pops up select "modal". In the modal view controller, I like to use code to return from the modal by calling:
To Presenting Storyboard View Controllers Programmatically scroll to that section in gravityjack on the link provided.
For example, I have a view controller that I created in storyboard which I can call programmatically with the following two statements: