0

I'm trying to implement UIModalTransitionStyle.flipHorizontal and it works but it shows just a black view. here is my code:

@IBAction func loadNextView(_ sender:UIButton){

    let nextVC = NextViewController()
    nextVC.modalTransitionStyle = UIModalTransitionStyle.flipHorizontal
    self.present(nextVC, animated: true, completion: nil)
}

Any of you knows why it shows a black view? or how can show the correct view?

I'll really appreciate your help

user2924482
  • 8,380
  • 23
  • 89
  • 173

2 Answers2

1

You need to load the VC like this [ nextID is it's id in storyboard ]

let nextVC  = self.storyboard?.instantiateViewController(withIdentifier: "nextID") as! NextViewController
Shehata Gamal
  • 98,760
  • 8
  • 65
  • 87
0

Try setting the presented view controller's modalPresentationStyle to overCurrentContext:

nextVC.modalPresentationStyle = .overCurrentContext
Xchord
  • 678
  • 1
  • 5
  • 20
  • What is the difference between `nextVC.modalPresentationStyle = .overCurrentContext` and `nextVC.modalTransitionStyle = UIModalTransitionStyle.flipHorizontal` ? – user2924482 Jun 26 '18 at 17:15
  • These are two different things, please check Apple documentation. – Xchord Jun 27 '18 at 06:12