Call storyboard scene programmatically (without needing segue)?

前端 未结 8 763
既然无缘
既然无缘 2020-12-04 10:10

I have a modal storyboard scene that I want to be accessible to all my other scenes. Creating a modal segue to it from every scene on my storyboard creates a big mess of str

8条回答
  •  自闭症患者
    2020-12-04 10:34

    Yes you can. Do something like this to get access to the VC, then just Modal Push it:

    UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"MainStoryboard_iPhone" bundle:nil];
    MyNewViewController *myVC = (MyNewViewController *)[storyboard instantiateViewControllerWithIdentifier:@"myViewCont"];
    

提交回复
热议问题