In objective-C, to move another viewcontroller from different storyboard, we will use following coding to fulfil what we want.
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"Customer" bundle:nil];
HomeSummaryViewController *creaccVC = [storyboard instantiateViewControllerWithIdentifier:@"HomeSummaryViewController"];
[self.navigationController pushViewController:creaccVC animated:YES];
In swift version, please help me to how to do just like Objective-C?
It's pretty much identical to the Objective-C version.
let storyboard = UIStoryboard(name: "Customer", bundle: nil)
let vc = storyboard.instantiateViewControllerWithIdentifier("HomeSummaryViewController")
self.navigationController?.pushViewController(vc, animated: true)
The above code in Swift looks like this:
let storyboard: UIStoryboard = UIStoryboard(name: "Customer", bundle: nil)
let homeView: HomeSummaryViewController = storyboard.instantiateViewControllerWithIdentifier("HomeSummaryViewController") as! HomeSummaryViewController
self.navigationController?.pushViewController(homeView, animated: true)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.