Search code examples
iosxcodeswiftanimationuistoryboardsegue

Animated segue from xib view to ViewController


I have one view called thirdView.xib and "allPicsViewController"(so there is no Storyboard Segue). My question is, if it is possible to perform animated segue (Cross Dissolve would be the best),instead of ordinary animation which goes from the bottom.

This code shows my "allPicsViewController" and it works,but the view animates from the bottom.

func showProfileController(){  
        let storyboard: UIStoryboard = UIStoryboard(name: "Main", bundle: nil)
        let vc: UIViewController = storyboard.instantiateViewControllerWithIdentifier("allPicsViewController")
        self.presentViewController(vc, animated: true, completion: nil)

        print("btn tapped")       
    }

I have also tried to set animated:false , but that was not good. Thanks.


Solution

  • From my comment above (to help other people):

    just set

    vc.modalTransitionStyle = UIModalTransitionStyle.CrossDissolve 
    

    before you present the view controller.