Using multiple detail views with TableView


Im trying to implement a table view page within my tabbed bar application. I have successfully made a table view containing data, and I want this to take me to a detail view. However I want separate detail views for each Cell, to allow me to create more detailed detail views using the UI. I have given the Seque's unique IDs to try and do this.

Currently it crashed every time I press the button, taking me to main.m

Here is the code I have:

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { switch (indexPath.row) { case 0: [self performSegueWithIdentifier:@"showDetail1" sender:self]; break; case 1: [self performSegueWithIdentifier:@"showDetail2" sender:self]; break; case 2: [self performSegueWithIdentifier:@"showDetail3" sender:self]; break; case 3: [self performSegueWithIdentifier:@"showDetail4" sender:self]; break; default: break; } }

The exception I get is:

"Terminating app due to uncaught exception 'NSGenericException', reason: 'Could not find a navigation controller for segue 'showDetail2'. Push segues can only be used when the source controller is managed by an instance of UINavigationController.'"



The ViewController where you have added your tableView, should be a part of a NavigationController. A ViewController can only be pushed if it is a part of NavigationController. Else try using Present Segue.

<strong>Solution 1:</strong>

Make your present ViewController in which you have added your tableView a part of NavigationController

If you are using StoryBoard, then select your ViewController in which you have added the tableView. With the Controller selected, choose <strong>Editor\Embed In\Navigation Controller</strong>

<strong>Solution 2:</strong>

If you do not want to use Navigation/Push design then you can present the ViewController. For that you have to use Present Segues.


  • UITableView cell goes blank when scrolling
  • Creating a checkmark inside a Pickerview [duplicate]
  • Protecting critical code from being called again
  • Why does Apple use assign rather than weak to store a delegate?
  • UICollectionView in UITableview - Get tag of tapped UICollectionView
  • Visual studio 2015 keystroke with mouse button
  • CRASH: *** -[__NSArrayM objectAtIndex:]: index 4294967295 beyond bounds [0 .. 9]
  • Caliburn Micro, How to use ContentControl (or display 'sub' ViewModel) using ViewModel Fir
  • How to Make a Spinner (In a Fragment) That Changes the App's Language?
  • Recording values of radio buttons in ember
  • Hide buttons on title bar in Java
  • LESS CSS how to modify parent property in mixin
  • Click on button in another program - FindWindow, C#
  • Flash radiobutton: how do I get the selected radiobutton?
  • jQuery: How to AJAXify WordPress Search?
  • Trying to get the char code of ENTER key
  • Selenium to click on a javascript button corresponding to a text
  • Button click event not firing in jQuery
  • How do I superscript characters in a UIButton?
  • how to save the state in userdefaults of accessory checkmark-iphone
  • onBackPressed() not being executed
  • Android fill_parent issue
  • Why value captured by reference in lambda is broken? [duplicate]
  • Adding a button at the bottom of a table view
  • How to recover from a Spring Social ExpiredAuthorizationException
  • Does CUDA 5 support STL or THRUST inside the device code?
  • jquery mobile loadPage not working
  • Properly structure and highlight a GtkPopoverMenu using PyGObject
  • ExecuteAsync RestSharp to allow backgroundWorker CancellationPending c#
  • How can I get HTML syntax highlighting in my editor for CakePHP?
  • Acquiring multiple attributes from .xml file in c#
  • How to CLICK on IE download dialog box i.e.(Open, Save, Save As…)
  • Can Visual Studio XAML designer handle font family names with spaces as a resource?
  • How can I remove ASP.NET Designer.cs files?
  • Are Kotlin's Float, Int etc optimised to built-in types in the JVM? [duplicate]
  • EntityFramework adding new object to nested object collection
  • Checking variable from a different class in C#
  • failed to connect to specific WiFi in android programmatically
  • java string with new operator and a literal
  • How can I use threading to 'tick' a timer to be accessed by other threads?