如果xib中只有根是uiview,加载此VC使用如下,ClassName对应的ViewController类名
let VC = ClassName(nibName: "XibName", bundle: nil)
如果Xib的根是VC,加载使用
let nib = Bundle.main.loadNibNamed("XibName", owner: self, options:nil)
let VC = nib?.firstas! ClassName
如果xib中只有根是uiview,加载此VC使用如下,ClassName对应的ViewController类名
let VC = ClassName(nibName: "XibName", bundle: nil)
如果Xib的根是VC,加载使用
let nib = Bundle.main.loadNibNamed("XibName", owner: self, options:nil)
let VC = nib?.firstas! ClassName