Create an account

Very important

  • To access the important data of the forums, you must be active in each forum and especially in the leaks and database leaks section, send data and after sending the data and activity, data and important content will be opened and visible for you.
  • You will only see chat messages from people who are at or below your level.
  • More than 500,000 database leaks and millions of account leaks are waiting for you, so access and view with more activity.
  • Many important data are inactive and inaccessible for you, so open them with activity. (This will be done automatically)


Thread Rating:
  • 672 Vote(s) - 3.53 Average
  • 1
  • 2
  • 3
  • 4
  • 5
'Show' segue in Xcode 6 presents the viewcontroller as a modal in iOS 7

#1
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:

[To see links please register here]


Any help is appreciated...

Thanks
Reply

#2
When a "Show" segue comes up as a modal segue in testing it is usually one of two problems:

1. The first view controller is not inside a navigation controller.

2. The storyboard XML is corrupted.

The solution to #2 is usually to remove and replace the segue, and it should correct itself. Sometimes just switching to some other presentation style, running, and switching back to "Show" fixes it.

This can also happen to "Show Detail" segues, and it can be more insidious.

Example:
I have a series of view controllers arranged in a UISplitViewController. They have segues Show->Show->Show->Show Detail. The last segue kept coming up modal. I tried everything to fix that last segue. The problem was that the *upstream* Show segue had been corrupted into a Show Detail segue (even though the storyboard still said it was a Show segue). I had been testing on iPhone, and I did not discover the real problem until I ran it on the iPad simulator. The segues were now Show->Show->*Show Detail*->Show Detail. On the iPhone the third segue looked just like a Show because it collapsed onto the navigation controller. However, it is still the *detail* view controller, and you cannot have a Show Detail *from* a detail view controller, so the OS does what it can to get your view controller on screen and displays it modally.

Lesson 1: Always test your UISplitViewController on iPad to make sure the segues are doing what you think.

Lesson 2: If your segue is coming up modal unexpectedly, check the *upstream* segues for corruption as well as the segue in question.
Reply

#3
Problem in my case was that I created Show (e.g. Push) segue **before** putting ViewController as rootViewController of UINavigationController. In other words I didn't have UINavigationController.
Then I deleted seque, **added UINavigationController and added seque again** and it worked. Tested on Xcode 9.0.1 / iOS 11.0.3.
Reply

#4
I am using XCode 9 with Swift 4. Note this version came out yesterday (September 20th).

For me this was just a caching bug. I had to choose "Present Modally", run the app and then choose "Show (e.g. Push)". Now everything works fine.
Reply

#5
I have had this exact issue with "Show (eg. Push)" for ages and I have just figured it out whilst trying to push a view controller onto a navigation controller that is in a Popover. It seems that the context of the called View Controller is the problem. So this is how I resolved it:

1. On the View Controller performing the Segue, check the "Defines Context" property in the Storyboard.
2. In the called View Controller, set the Presentation property to "Current Context".
Reply

#6
I believe this is a bug in Xcode 7.2. In order to workaround, you can create a "Push (deprecated)" segue and then in the Storyboard editor, select the segue and change it to Show(e.g. Push)
Reply

#7
> 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][1] 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).

[1]:

[To see links please register here]

Reply

#8
For me, my storyboard lacked a navigation controller. I am creating the navigation controller programmatically, which works fine in iOS8, but not iOS7.

**SOLUTION**

1. In your storyboard, select the main view controller and in the Xcode menu, choose *Editor > Embed In > Navigation Controller*.
2. Select the new navigation controller, and in the attributes inspector on the right, under *View Controller*, make sure *Is Initial View Controller* is checked.
3. Run the app. Should be fixed now.

Reply

#9
Basically the answer of Jomafer is partly correct. The controller which you are pushing needs to be preceded by a UINavigationController. You dont really need to push the UINavigationController at all. As long the storyboard knows its within a UINavigationController, all is well.
Reply

#10
I ran into this problem and the only solution I found that works for me is to use the deprecated 'Push' segue.
Reply



Forum Jump:


Users browsing this thread:
1 Guest(s)

©0Day  2016 - 2023 | All Rights Reserved.  Made with    for the community. Connected through