简体   繁体   中英

Move from xib to storyboard in ios

I have app that has single xib file and in this xib file I have created tableList ok that's fine it is working fine.

Here my main requirement is when I click tableList row I want to move "xib" file to my UIStroryBoard and for this I have searched lot in internet but I did not get any solutions.

Please help me with some code.

When I search in internet only I get how to move one xib to another xib like below code, but I want to move xib file to UIstrotyboard.

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

Here is an example that you can push to a ViewController on Storyboard

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

this is the same code but in 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)

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM