码迷,mamicode.com
首页 > 编程语言 > 详细

swift 代码加载xib storyboard

时间:2015-08-07 20:18:58      阅读:296      评论:0      收藏:0      [点我收藏+]

标签: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

标签:swift   xib   storyboard   

原文地址:http://blog.csdn.net/liuxiaoming1109/article/details/47340449

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!