一, 实例化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
网友评论