Storyboard Segue From View Controller to Itself Storyboard Segue From View Controller to Itself ios ios

Storyboard Segue From View Controller to Itself


If you are using a navigation controller you need to push the ViewController into the nav stack. In this example, i named my ViewController "VDI" in my Storyboard ID setting.

UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"MainStoryboard" bundle: nil];YourVC *dest = [storyboard instantiateViewControllerWithIdentifier:@"VDI"];[self.navigationController pushViewController:dest animated:YES];

If you don't want the NavigationController to keep adding itself into your "Back" history you can pop the stack before adding to it like so.

UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"MainStoryboard" bundle: nil];YourVC *dest = [storyboard instantiateViewControllerWithIdentifier:@"VDI"];UINavigationController *navController = self.navigationController;[navController popViewControllerAnimated:NO];[navController pushViewController:dest animated:YES];


Using Xcode 5 there is a much simpler solution.

  1. Click the table cell in the storyboard
  2. Open the Connections Inspector (right arrow icon in the upper right)
  3. Under "triggered segues" you see "selection"
  4. Drag from the circle next to "selection" to the cell in the storyboard

That's it.


I developed a method to create a segue using a phantom button. I believe it will solve your problem. You can read about it in my answer here.