0
votes

I have a tableViewController that segues as popover to another tableViewController and it works well. But when I try to segue as show (e.g. push) from the second tableViewController to a third tableViewController it does not work, it is segueing as popover since the third tableViewController slides from bottom to top, not from right to left.

I saw this implemented in the Calendar app, the create new event is popover segue (slides from bottom to top) and the Travel time cell segues from right to left, but I can't seem to do that.

If the answer is in code, I would really appreciate if it would be Swift

Screenshot of the app layout - img

1
your third tableviewcontroller show in popover or not?IOS Singh
It shows as popover (bottom to top) but I want it to show from (right to left) - The segue kind is set to Show (e.g. push) in the attributes inspector.Steve Mclean
you should use the delegate to move third viewController. that is, when user tap to button then call delegate in first viewController and push to third view controllerIOS Singh
how do i do that? what's more, the first segue that was originally set as popover, still shows as popover although I have changed it to push - any idea? check the screenshot I just included in my questionSteve Mclean
which action you have used to push to third viewcontrollerIOS Singh

1 Answers

1
votes

You need to make sure that your second table view controller is embedded in a navigation controller for the push segue to work.

Otherwise, as you can see, it will segue to your third table view controller, but Xcode will use the default and end up presenting your controller modally.

To embed your view controller in its own navigation controller, with your second view controller selected, choose Editor > Embed In > Navigation Controller. And that's it.

Update: Thanks for adding a screenshot, I can see already one problem here. You don't need the 3rd navigation controller, and actually you should'nt add it, because it's the reason of your problem. The reason behind that is, the Controller 3 will be pushed onto the stack naturally, because Controller 2 is already embedded in its own Navigation Controller. To illustrate what I'm explaining, this is an working example to show you how it should look like:

enter image description here

  • As you can see, Controller 1 is embedded in its own Navigation Controller, so that it can have its own Navigation Bar.
  • Now, you want to Present Modally your Controller 2, and since you want Controller 2 to have a Navigation Bar as well, then you need to embed in its own Navigation Controller too, because a Modal Segue is just a view controller presenting another view controller modally that doesn't give you a Navigation Bar for free (understand here that in the case of a Modal Segue, your Controller 2 will not get added onto the stack)
  • Finally, you can just create a Push Segue from Controller 2 to Controller 3, and Controller 3 will naturally be added onto the stack (Controller 2 being the root controller of the navigation controller) creating the push transition that you are looking for.

Please let me know if you have any questions, I'd be glad to help