我的应用程序有单个xib文件,在这个xib文件中我创建了tableList ok,没关系,它工作正常。
这里我的主要要求是当我点击tableList行时,我想将“xib”文件移动到我的UIStroryBoard,为此我在网上搜索了很多但我没有得到任何解决方案。
请帮我一些代码。
当我在互联网上搜索时,我得到了如何将一个xib移动到另一个xib,如下面的代码,但我想将xib文件移动到UIstrotyboard。
DetailViewController *detailVC = [[DetailViewController alloc]initWithNibName:@"DetailViewController" bundle:nil];
[self.navigationController pushViewController:detailVC animated:YES];
答案 0 :(得分:3)
以下示例可以推送到ViewController
Storyboard
UIStoryboard *sb = [UIStoryboard storyboardWithName:@"Your_storyboard_name" bundle:nil];
DetailViewController *detailVC = [sb instantiateViewControllerWithIdentifier:@"DetailViewController"];
[self.navigationController pushViewController:detailVC animated:YES];
答案 1 :(得分:0)
这是相同的代码,但速度很快
let myStoryBoard = UIStoryboard(name: "<the name of new storyboard as in
Project Navigator >", bundle: nil)
// the View Controller on the Story board that you will navigate to it
let vc = sb.instantiateViewController(withIdentifier: "< the string identifier of the view controller >")
vc.modalTransitionStyle = .flipHorizontal // as example
present(vc, animated: true)