0

Lets say I have two UIViewControllers, we can call them ControllerOne and ControllerTwo.

In my app I have created a custom UIStoryboardSegue animation between ControllerOne and ControllerTwo. The effect I want to create with the animation is that it will feel like a part from ControllerTwo sliding onto ControllerOne so that the segue between the two UIViewControllers does not seems to be a segue.

From this point I don´t know which approach is the best one to take. The design for ControllerTwo is set through the storyboard but how do I get it?

(What I know is that I can´t copy the values from ControllerTwo into the segue because they have not been set yet so it will throw an error.)

1 Answers1

0

Usually we Passing Data via this func prepareForSegue in the UIViewController class

override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
    if segue.identifier == "idFirstSegue" {
        let secondViewController = segue.destinationViewController as SecondViewController
        //secondViewController.message = ...
    }
}

You can also override perform func in the subclass of the UIStoryboardSegue class, here is the code :

 override func perform() {
  var firstVC = self.sourceViewController as UIViewController!
  var secondVC = self.destinationViewController as UIViewController!
 //Then copy design from destination  
}

The article fits you , I think.

dengApro
  • 3,848
  • 2
  • 27
  • 41