extensa5620
extensa5620

Reputation: 699

From ViewController to TableViewController

I have a question on iOS7. I have a default story board setup with a ViewController. I added another TableViewController and linked them using a button on ViewController. Xcode allows the linkage but when I run the app, Xcode crashes with the following error.

Storyboard setup

2014-03-29 20:58:34.862 VC to TableView[4668:60b] *** Terminating app due to uncaught exception 'NSGenericException', reason: 'Push segues can only be used when the source controller is managed by an instance of UINavigationController.'

Why can't i have the above setup? I've tried with a NavigationController in front and it works.

Upvotes: 0

Views: 110

Answers (2)

dlock
dlock

Reputation: 9577

The solution is really easy. To have Push/Pop Segues, You need your views to be embedded inside a UINavigationController.

  1. Select the first ViewController
  2. From the Menu Bar, Select Editor > Embed In > Navigation Controller

Upvotes: 1

Wain
Wain

Reputation: 119031

The error message is quite clear on the reason:

'Push segues can only be used when the source controller is managed by an instance of UINavigationController.'

the underlying reason being: where would the push go if you don't have a navigation controller...

So, you need a navigation controller or you need to use a modal segue.

Upvotes: 1

Related Questions