NSGenericException', reason: 'Push segues can only be used when the source controller is managed by an instance of UINavigationController

后端 未结 11 674

so I\'m making an app with 5 view controllers, the first is embedded in a UINavigationController and the segue between the first 4 view controllers works fine. However intro

相关标签:
11条回答
  • 2020-12-07 18:17

    You just need to embed a Navigation Controller into your Source View Controller ( The one initial view, not the view you are pushing for ) . This can be done by selecting the Source View Controller and Go To Editor--> Embed In --> Navigation Controller.

    If you think that the Navigation Bar that the Navigation Controller has done . Simply select the Navigation Controller , In the "Show the Attributes Inspector" disable the Shows Navigation Bar.

    0 讨论(0)
  • 2020-12-07 18:17

    I have faced same problem after few minutes I could solve it.

    I have deleted segue connections and I have made connections again from one view to other views.That's it the problem is solved. the thing is I have deleted views and I have made few changes to the views in story board scene. And important thing is you need to check connections working properly from one view to another view.

    This may be helpful to some one I hope....

    0 讨论(0)
  • 2020-12-07 18:18

    I have faced same problem and I searched a lot but nothing could help me. I tried in many ways.Finally I found solution. I am doing a project in xcode 5 and developed views using story board. I have 3 screens and my connections are..

    view1 to view2-->push

    view2 to view3-->push

    view2 to view1-->modal(this is my mistake we need to use push only)

    this is fine working well but I have placed bar button item(Back) in view2 and segue connection was modal . when I click on view2 bar button it is redirected to view1 properly but when I try to go ahead from view1 to view2 I got the same error. Because if you give push segue type from source view to destination view you need to use same push segue from destination view to source view..

    I hope it will be helpful to someone..thanks

    0 讨论(0)
  • 2020-12-07 18:20

    This is most likely because your push segue from the button or whatever is pointing to a view controller not the navigation view controller your view controller inherits. So, you have to point the segue to the navigation controller.

    Hope this helps.

    0 讨论(0)
  • 2020-12-07 18:24

    add Navigation Controller to your initial view

    1. Select the initial view
    2. Go To Editor--> Embed In --> Navigation Controller.
    0 讨论(0)
提交回复
热议问题