在SWIFT中實例化并呈現viewController發行我開始看新的Swift在……上面Xcode 6,我嘗試了一些演示項目和教程?,F在我被困在:實例化,然后呈現viewController從一個特定的故事板目標-C溶液UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"myStoryboardName" bundle:nil];
UIViewController *vc = [storyboard instantiateViewControllerWithIdentifier:@"myVCID"];
[self presentViewController:vc animated:YES completion:nil];如何在SWIFT上實現這一點?
3 回答

暮色呼如
TA貢獻1853條經驗 獲得超9個贊
let viewController:UIViewController = UIStoryboard(name: "Main", bundle: nil).instantiateViewControllerWithIdentifier("ViewController") as UIViewControllerself.presentViewController(viewController, animated: false, completion: nil)
UIViewController *viewController = [[UIStoryboard storyboardWithName:@"MainStoryboard" bundle:nil] instantiateViewControllerWithIdentifier:@" ViewController"];
/* Helper to Switch the View based on StoryBoard @param StoryBoard ID as String */func switchToViewController(identifier: String) { let viewController = self.storyboard?.instantiateViewControllerWithIdentifier(identifier) as! UIViewController self.navigationController?.setViewControllers([viewController], animated: false)}
- 3 回答
- 0 關注
- 1217 瀏覽
添加回答
舉報
0/150
提交
取消