ios - 如何在我的情况下创建 ViewController? IOS 7

标签 ios uiviewcontroller

我得到了第一个没有导航 Controller 的ViewController,我通过

从它转到第二个ViewController
if (!self.mapViewController)
{
   self.mapViewController = [self.storyboard instantiateViewControllerWithIdentifier:@"MapViewController"];
}
[self presentViewController:self.mapViewController animated:YES completion:nil];

我使用 prepareForSegue 向其发送一些数据,但我需要它也与导航 Controller 一起使用。 我在 Storyboard中嵌入了导航 Controller ,但我的代码仍然调用第二个 ViewController ,但没有导航。

最佳答案

我不是 Storyboard的专业人士,但我相信 presentViewController 您应该使用以下函数来呈现基于 segues 的 Storyboard VC。

[self performSegueWithIdentifier:@"SegueIdentifierHere" sender:nil];

确保在你的 Storyboard中你也包含了一个 UINavigationControllerVC。

关于ios - 如何在我的情况下创建 ViewController? IOS 7,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21386456/

相关文章:

ios - 在不重新加载所有数据的情况下更新 UIImageView

ios - 如何加载所有 View Controller Storyboard,但跳过自然顺序并直接转到特定 View ?

iphone - 触摸事件不适用于 UIScrollView 内的 UIView

ios - 以编程方式创建的 UIViewController 被导航栏部分隐藏

objective-c - ViewController View 从 ~(0,20) 开始

iOS8 : Impossible for Beta Testers to Access Game Center

ios - 如何从 UIViewController 移动到 SKView,反之亦然?

ios - 将 iOS 10.3.3 与 Xcode 版本 8.2.1 一起使用?

ios - 格式化与共享表共享的信息

ios - UIImagePickerController 出现,但相机不会在 iOS 5 上启动