在 ios 内从 xib 移动到故事板

Move from xib to storyboard in ios

我的应用程序只有一个 xib 文件,我在这个 xib 文件中创建了 tableList,没问题,它工作正常。

这里我的主要要求是当我单击 tableList 行时我想将 "xib" 文件移动到我的 UIStroryBoard 为此我在互联网上搜索了很多但我没有得到任何解决方案。

请帮我写一些代码。

当我只在互联网上搜索时,我知道如何像下面的代码那样将一个 xib 移动到另一个 xib,但我想将 xib 文件移动到 UIstrotyboard。

DetailViewController *detailVC = [[DetailViewController alloc]initWithNibName:@"DetailViewController" bundle:nil];
    [self.navigationController pushViewController:detailVC animated:YES];

这是一个示例,您可以在 Storyboard

上推送到 ViewController
UIStoryboard *sb = [UIStoryboard storyboardWithName:@"Your_storyboard_name" bundle:nil];
DetailViewController *detailVC = [sb instantiateViewControllerWithIdentifier:@"DetailViewController"];
[self.navigationController pushViewController:detailVC animated:YES];

这是相同的代码,但在 swift

     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)