0
votes

I'm using a navigation controller and it works great. However, some custom buttons segue to new ViewControllers (not in the stack) and I don't like the push-type transition animation it uses.

GOAL: I want to the transitions (described above) to mimic a nav-stack pop transition (where the current view slides to right, revealing the view underneath).

I've successfully simulated a nav-pop using the below code, but then after my buttons and nav-bar back button are super glitchy.

@IBAction func Page2_to_Page1_ButPush(sender: AnyObject) {

    var curPage: UIViewController = self.storyboard!.instantiateViewControllerWithIdentifier("Page2_ID") as! UIViewController
    var prevPage: UIViewController = self.storyboard!.instantiateViewControllerWithIdentifier("Page1_ID") as! UIViewController

    self.navigationController?.pushViewController(prevPage, animated: false)
    self.navigationController?.pushViewController(curPage, animated: false)
    self.navigationController?.popViewControllerAnimated(true)

}

Can anyone supply a simple way to make my segues simulate a nav-pop?

Details: X-Code 6.4 Swift Storyboard

1

1 Answers

0
votes

Here's the solution:

iOS Segue - Left to Right -

Simple, easy, works perfect. Add the "SegueFromLeft" class code shown in the link, select the segue you want to present from left, select custom, pointed it at "SegueFromLeft", and the animation is dead on.

Bonus: Even better, it syncs up with the navigation controller, so the nav "Back" button still works.