Zhao Yi Zhao Yi - 5 months ago 12
Swift Question

How to show segue from bottom of the screen

I created a segue between two controllers(A, B). In controller A, I am using "performSegueWithIdentifier" method to show controller B's view. However, I want to add an animation on presenting the B. I want it to show/hide from the bottom of the screen. How should I do this?


I achieved this using Present As Popover when choosing the kind of segue in Attributes Inspector. Make sure you point your anchor to the view controller you are segueing from, this answer was pretty helpful.

Make sure you give it an identifier (using this identifier below) and use the typical perform segue code whenever you wish to perform the segue:

dispatch_async(dispatch_get_main_queue()) { 
    [unowned self] in
        self.performSegueWithIdentifier("Identifier", sender: self)

Make sure you replace "Identifier" string with a string of your own segue identifier.