Reputation: 1977
I implemented a Facebook like swipe menu, but i have problems with the navigation.
I have 3 ViewControllers
Now i want to perform a segue from the HomeViewController to the Second page. I placed a button at the HomeViewController and cmd + dragged it to the second page, Action segue: Push.
When i run the application, i get the next error message:
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.'
So basically I want to create the exact same navigation what the facebook uses, menu button at the main page else back button at the top left corner.
Any idea would be appreciated!
Upvotes: 1
Views: 1207
Reputation: 23223
You might want to consider a container view controller. Instead of having the menu leave the current view controller and go to a different one, have the menu come up as a child view controller in a pre-defined view on the original view controller.
This has some benefits like:
When the user triggers the menu (swipe/tap/etc) you would add the menu "child" view controller to the (offscreen) view, then animate the view to visible location (which could be as simple as changing the frame.origin.x). When dismissed just reverse the process.
Upvotes: 1