'Show' segue in Xcode 6 presents the viewcontroller as a modal in iOS 7

momentsnapper picture momentsnapper · Oct 30, 2014 · Viewed 13k times · Source

I have two view controllers in my iPhone application (built with swift) built with Xcode 6.1 and uses storyboards.

The first view controller is embedded in a navigation controller in the storyboard and the segue for the second view controller is a 'Show' segue.

When the application is run, it properly shows the transition as a push in iOS 8.x, but in iOS 7.x it appears as a modal without the navigation bar.

My application requirement is to show the transition as a push regardless of whether it's iOS 7 or iOS 8. Any ideas to get this working as push in both versions of the iOS?

I saw a related post where this issue is mentioned, but could not find a solution to the problem: Adaptive segue in storyboard Xcode 6. Is push deprecated?

Any help is appreciated...

Thanks

Answer

Tommie C. picture Tommie C. · Oct 27, 2015

This solution is different from the others in the following ways:

  1. It includes a method to examine and verify the issue
  2. The cause of the issue is traced to the source (a change in the segue type)
  3. The solution is very simple (delete and recreate a new segue)
  4. Please note the requirements in the text

I just gave a very detailed SO answer that fully explains what is happening and why, but the simple solution is you can delete the Segue that is not pushing and then recreate it on the storyboard. The reason is that there is likely a broken bit of xml in the segue (see extended answer for example/instructions how to confirm this issue).

After you confirm that you have at least one UINavigationController within the view hierarchy, be sure that the segue is NOT a manual segue and does NOT have an action associated with it (by viewing the segue in the storyboard as Source Code). Delete the existing segue and then Ctrl-drag from a UIView/UIControl to the target view controller and if custom action is needed intercept the call to destination controller in prepareForSegue.

Also to confirm that this solution works for you please do the following:

  • Verify that your initial view controller (with the arrow on it) is a UINavigationController and that it has a normal content view controller as it's root view controller. (or that you embed your initial view controller inside of a UINavigationController)
  • Read my extended comments on an earlier response to a very similar question (linked above).