swift3.0实例化StoryBoard视图

一, 实例化sbzViewController

首先设置sb中的vc的StoryBoard ID(如果vc前有nav,设置nav的StoryBoard ID)

let sb = UIStoryboard(name:"SBName",bundle: Bundle.main)

let vc = sb.instantiateViewController(withIdentifier: "ControllerName")

self.present(vc, animated: true, completion: nil)

二, 实例化View

let vi : CustomView = Bundle.main.loadNibNamed("CustomView", owner: nil, options: nil)?.last as!CustomView

©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容