hqt hqt - 1 year ago 57
iOS Question

Tricky way to make segue between two scenes with long distance on Storyboard

I'm sorry if my question looks dumb. Because on my storyboard, there are many scenes. For example, in sceneA, I have a buttonA. And I want to connect to sceneB when user click buttonA. So I create a segue between buttonA and sceneB.

The problem is: because my storyboard is big, so distance between two scene A and B is overflow of my macbook screen, so I cannot control drag to make a segue. The only solution I currently have is: drag the sceneB to nearer sceneA (of course can overflow some other scenes) and make the segue. After that, drag the sceneB again to original position.

I think there is another clever way for this task. (for example: make a segue in setting board), But I cannot find out. Please tell me.

Thanks :)

Answer Source

I suggest you to stop doing segues on the storyboard. I had also similar situation and I've started to do segues only from code. Segues in code are also easy and gives you more dynamic control. If you don't know how to do it, here are the steps:

  1. Set Storyboard ID for your VC in Identity inspector.
  2. Grab your VC in code:


UIViewController *vc = [self.storyboard instantiateViewControllerWithIdentifier:@"SampleID"];
  1. Make a segue any way you want.