swift 代码加载xib storyboard

前端之家收集整理的这篇文章主要介绍了swift 代码加载xib storyboard前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

初学swift,代码加载xib storyboard


-.加载xib

override init(nibName nibNameOrNil: String?,bundle nibBundleOrNil: NSBundle?){
   super.init(nibName: nibNameOrNil,bundle: nibBundleOrNil)
}
    
convenience init() {
   var nibNameOrNil = String?("ViewController")
   self.init(nibName: nibNameOrNil,bundle: nil)
}
    
required init(coder aDecoder: NSCoder) {
    fatalError("init(coder:) has not been implemented")
}

二.加载storyboard 跳转到storyboard
var jumpViewController: ViewController
            = UIStoryboard(name: "Main",bundle: nil).instantiateViewControllerWithIdentifier("Storyboard ID") as! ViewController
            self.navigationController?.pushViewController(jumpViewController,animated: true)


Storyboard ID 是storyboard绑定的ID viewController 是绑定的Class

猜你在找的Swift相关文章