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

后端 未结 11 429
离开以前
离开以前 2021-01-01 10:11

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 navigat

相关标签:
11条回答
  • 2021-01-01 10:49

    Here is the workaround for that. It looks like a bug in Xcode for iOS 7. You need to create a dummy UINavigationController and link all your free UIViewControllers to this navigation controller. Worked for me.

    0 讨论(0)
  • 2021-01-01 10:50

    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).
    0 讨论(0)
  • 2021-01-01 10:51

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

    0 讨论(0)
  • 2021-01-01 10:54

    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.

    0 讨论(0)
  • 2021-01-01 10:54

    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.

    0 讨论(0)
  • 2021-01-01 10:58

    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.
    0 讨论(0)
提交回复
热议问题