varappDelegate =UIApplication.sharedApplication().delegateas!AppDelegate
Swift中 有时候添加ViewController的时候,我们需要使用UIStoryboard进行加载
我们在AppDelegate中创建MainStoryBoard
varstoryBoard:UIStoryboard?
storyBoard=UIStoryboard(name:"Main",bundle:nil)
funcgetMainStoryBoard()->UIStoryboard{
returnstoryBoard!
}
varcir_vc:CircleImageViewController! =appDelegate.getMainStoryBoard().instantiateViewControllerWithIdentifier("CircleImageViewController")as!CircleImageViewController
self.navigationController?.pushViewController(cir_vc,animated:true)
通过StoryBoardId创建了ViewController
原文链接:https://www.f2er.com/swift/327198.html