1

I have this story board and I'm trying to make custom segue to slide the View Controller to the left side and from right to present the Table view Controller. I need unwind segue to go back to the Main view controller (the one I segue from). I know that such question might be asked before but i think here the case is more specific as it's involves Table view controller. Anyone please help. Btw I'm writing in Swift.

My goal is to have segue in both directions with custom transition. Because if you chose show segue it is presenting the table viewer controller from bottom to top and not from left to right.

I asked this question where I'm using classes to handle the custom transitions but i'm getting errors unfortunately. Create Unwind segue error (lldb)

Thank You.

enter image description here

Community
  • 1
  • 1
KO55A
  • 39
  • 9

2 Answers2

1

This is actually just an unwind segue you need. UITableViewController inherits from UIViewController so it can do everything a view controller can do (and much more!). I suppose its slightly different in the way you set it up. So you need to right click from your view controller (the yellow circle at the top of the middle view controller in your image) to the edit icon (on the right hand side on the middle view controller in your image). This will allow you to select a unwind segue function to call.

If you didn't know, before doing that you need to setup your unwind segue function. Long story short, basically just add the follow to the view controller you want to unwind to.

@IBAction func unwindToThisViewController(segue: UIStoryboardSegue) {
   /// Do something here if you want to
}

Then you just call your perform segue from wherever you need it

performSegueWithIdentifier("myUnwindSegueName", sender: nil)
Welton122
  • 1,101
  • 2
  • 13
  • 28
  • Thanks Weldon I've updated the question i tried what you suggested and is working but the transition is bottom to top and the other way around. And my goal was to have left to right and right to left – KO55A May 27 '16 at 20:20
  • 1
    So now you have that setup, you can use a custom segue to do the rest.Here's a link on how to do it: http://www.appcoda.com/custom-segue-animations/ – Welton122 May 27 '16 at 20:36
  • I tried with this tutorial and did not succeeded. I'm curious why you told me to make the unwind for the navigation view controller instead of the table view controller is this what I'm doing wrong because so far I tried to create the unwind in the table vi contr object -> exit ? – KO55A May 27 '16 at 20:41
  • My apologies, perhaps my explanation was not the best. I did mean for you to create the unwind from the table view controller to your previous view controller. So if you want to perform an animation which is not a default one, then you need to make a custom segue. So the part you should pay attention to in that tutorial is the Custom Segue Implementation. Where they setup a custom segue class and in the perform function, animate the transition. – Welton122 May 27 '16 at 20:45
0

Check out this tutorial for the exit(unwind segue): Segue from modal view to tab bar view controller and not lose tab bar

In regards to excecuting the segue just do this:

performSegueWithIdentifier("yourSegueIDGoesHere", sender: self)

Community
  • 1
  • 1
Zander
  • 414
  • 2
  • 16
  • Zander thank you but I do need custom direction from left to right and right to left So think i need to include segue classes for that will override perform funcm, which I already did but is not f** working I did not mention this as I expected to get fresh answers to try new things. – KO55A May 27 '16 at 20:22