swift 代碼載入xib storyboard

來源:互聯網
上載者:User

標籤: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 代碼載入xib storyboard

相關文章

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.