Search code examples
iosinterface-builderecslidingviewcontroller

Dismissing a ViewController does not get to desired Controller


I am terrible at understanding work with interface builder, so (probably dumb) question comes. I have created sliding view controller. When I click a cell, I want this controller slide back as it was. I used [self dismissViewControllerAnimated:YES completion:NULL];. It used to dismiss table view controller (when I did not use Sliding). However, not it throws me not to previous controller, but to login page (initial controller). Have a look at the picture.enter image description here

Hope this provides enough information. Sorry if it is not enough, as I am really bad with interface builder. I will add anything needed as requested. Thank you.

EDIT: I have also tried to drag (holding ctrl) from sliding controller and chose ECSlidingSegue. In such case there is nothing going on.


Solution

  • Normal behavior of modal is when dismissed it shows its Parent Controller, in your case its I guess LoginViewController, form where you must have presented the TableViewController as modal.

    However, if you wish to show a different controller other than the Parent, you can choose to push a new controller when come from TableViewController, or, you can achieve modal appearance with simple push of navigation controller, and I guess this would be easier and correct in your case.

    So instead of presenting the TableViewController as modal, push it with Modal animation, and on selection of cell InboxViewController will be pushed.

    There are few changes you need to do.

    1. Create a Custom Segue from LoginController to TableViewController.
    2. Create a push segue from TableViewController to InboxViewController.

    I hope it helps.

    Cheers.