I am new to iOS app development and currently facing some issues segueing from a UIButton to a UIViewController. I did above in Main.storyboard by:
After running this, i get below error
*** 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.'
Need help on resolving above error. Would appreciate it if solution comes with screenshots since i'm a newbie. Thanks!
After implementing @technerd solution, it still does not work. Below are images of the Navigation Controller menu and Action Segue Menu
From error logs it looks like you have not embedded UINavigationController
as initial controller in you storyboard.
So first set UINavigationController
as initial controller.
Because push
and pop
operation only performed when there is Navigation stack available.
To know how Navigation Stack works, go through this link.
Once you set Navigation as InitialViewController, then set your first viewcontroller you want to show first as rootViewController of that navigation controller.
Then you can drag push from button to secondViewController to push from firstViewController to secondViewController.
As you can read in screenshot that Push(Deprecated)
, so you have to use Show
relationship. Show
also perform same operation as Push
.
Update :
As per your question update, you are facing that you are not able to show other Action Segue. Follow below steps to make it available.
Use Trait Variations
option under Interface Builder Document
on right side panel.For more details check this thread.