美文网首页
swift3.0实例化StoryBoard视图

swift3.0实例化StoryBoard视图

作者: b6732342bd5f | 来源:发表于2017-12-04 15:16 被阅读0次

    一, 实例化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

    相关文章

      网友评论

          本文标题:swift3.0实例化StoryBoard视图

          本文链接:https://www.haomeiwen.com/subject/ffrxixtx.html