简体   繁体   English

如何从 xib 到 storyboard 的视图控制器?

[英]How to segue from a xib to a viewcontroller from a storyboard?

I'd like to combine two different Xcode projects.我想结合两个不同的 Xcode 项目。 One uses a xib file and the second uses a storyboard .一个使用xib文件,第二个使用storyboard After adding the appropriate files to the existing project, how can it be so that the xib knows about the storyboard so that a segue be made using a button from the xib to a different view controller in the storyboard?将适当的文件添加到现有项目后,如何让xib知道storyboard以便使用 xib 中的按钮到 ZCD9F90C00720AB40B9791AC 中的不同视图 controller

create new view controller and inside the class load the xib by code.创建新视图 controller 并在 class 内部通过代码加载 xib。 in ViewDidload在 ViewDidload

let popupView  = DropDownView.init(frame: self.view.frame)
self.view.addSubview(popupView)

or add a view inside the new ViewController and assign the xib class to it.或者在新的 ViewController 中添加一个视图并将 xib class 分配给它。

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

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