简体   繁体   English

从非Storyboard ViewController隔离到ViewController

[英]Segue to a ViewController from non-Storyboard ViewController

Im using Storyboard for most screens in my iPhone app. 我在iPhone应用程序中的大多数屏幕上都使用Storyboard。 However, I have one screen in my storyboard where I dynamically load a XIB an embedded it within the main view. 但是,我的情节提要板上有一个屏幕,我在其中动态加载XIB并将其嵌入到主视图中。 This XIB have an image and some text and is connected to its own UIViewController. 该XIB具有图像和一些文本,并连接到其自己的UIViewController。 My problem is that when I tap on the image in the XIB I want to segue to another UIViewController in my Storyboard. 我的问题是,当我点击XIB中的图像时,我想选择到Storyboard中的另一个UIViewController。 However, because my XIB is not in my Storyboard (its dynamically added at runtime) there is no way I can connect my XIB's view controller with a segue. 但是,由于我的XIB不在我的情节提要中(它在运行时动态添加),所以我无法将我的XIB的视图控制器与segue连接。 I'm getting the error "Receiver () has no segue with identifier" . 我收到错误消息“ Receiver()与标识符没有联系” This makes sense because the segue is not connected so is there anyway tha tI can programmatically segue to the other view? 这是有道理的,因为segue未连接,那么是否可以通过编程方式将segue绑定到其他视图? I've seen examples where I can have a modal transition, but instead I would like to have a "push" transition. 我已经看到了可以进行模式转换的示例,但我想进行“推送”转换。

Thanks 谢谢

Brian 布赖恩

我不知道我是否真的了解您的问题,但是如果您想进行推送转换,请使用以下命令:

[self.navigationController pushViewController:someViewController animated:YES];

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM